1. Interpreter Mod We Can All Get Behind
- Posted by c.k.lester <euphoric at cklester.?o?> Nov 20, 2007
- 668 views
- Last edited Nov 21, 2007
How about block commenting? That would be awesome and could significantly advance the cause for documenting code. /* Some Topic Header Some topic discussion. Blah blah blah. */ Sweet! In the meantime, for documenting your code, please get <a href="http://sourceforge.net/projects/eumakedoc">Euphoria MakeDoc</a>
2. Re: Interpreter Mod We Can All Get Behind
- Posted by Bernie Ryan <xotron at b??efrog.com> Nov 20, 2007
- 640 views
- Last edited Nov 21, 2007
c.k.lester wrote: > > How about block commenting? That would be awesome and could > significantly advance the cause for documenting code. > > /* > Some Topic Header > Some topic discussion. Blah blah blah. > */ > > Sweet! > > In the meantime, for documenting your code, please get > > <a href="http://sourceforge.net/projects/eumakedoc">Euphoria MakeDoc</a> And How about a line continuation symbol Example: "This is a long string that I want to continue on the next line __ so I can just use the two underscores to continue it on this line" Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
3. Re: Interpreter Mod We Can All Get Behind
- Posted by c.k.lester <euphoric at c?leste?.com> Nov 20, 2007
- 652 views
- Last edited Nov 21, 2007
Bernie Ryan wrote: > And How about a line continuation symbol > > Example: > > "This is a long string that I want to continue on the next line __ > so I can just use the two underscores to continue it on this line" Why would you want that? Euphoria already ignores line breaks in code so you can do something like "This is a long string that I want to continue on the next line " & "so I can just use the two underscores to continue it on this line" For string sequences, just use an editor that has word wrapping. :) Besides, it would be a pain to implement. What if my string sequence has a double underscore in it?
4. Re: Interpreter Mod We Can All Get Behind
- Posted by Bernie Ryan <xotron at b?u?frog.com> Nov 21, 2007
- 626 views
c.k.lester wrote: > > Bernie Ryan wrote: > > And How about a line continuation symbol > > > > Example: > > > > "This is a long string that I want to continue on the next line __ > > so I can just use the two underscores to continue it on this line" > > Why would you want that? Euphoria already ignores line breaks in code > so you can do something like > > "This is a long string that I want to continue on the next line " > & "so I can just use the two underscores to continue it on this line" > So I can do this which I think is less confusing: record("MyStructure", "__ item1 long 1 __ item2 pointer 1 __ rect STRUCT RECT __ item3 byte 10 item4 uint 1 __ ") > > For string sequences, just use an editor that has word wrapping. :) > > Besides, it would be a pain to implement. What if my string sequence has > a double underscore in it? Underscores are only allowed inside of identifiers. If they are inside a sting they would be ignored. Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
5. Re: Interpreter Mod We Can All Get Behind
- Posted by CChris <christian.cuvier at agriculture.?ou?.fr> Nov 21, 2007
- 624 views
c.k.lester wrote: > > Bernie Ryan wrote: > > And How about a line continuation symbol > > > > Example: > > > > "This is a long string that I want to continue on the next line __ > > so I can just use the two underscores to continue it on this line" > > Why would you want that? Euphoria already ignores line breaks in code > so you can do something like > > "This is a long string that I want to continue on the next line " > & "so I can just use the two underscores to continue it on this line" > > For string sequences, just use an editor that has word wrapping. :) > > Besides, it would be a pain to implement. What if my string sequence has > a double underscore in it? Other languages use """ (three double quotes) to start and end a verbatim string (ie no escape chars, line breaks, spacing and tabbing count). This is missing in Eu. Others use %" whatever " for the purpose. I'd rather save % for when there will be macros of some sort, but both would be fine with me. Also U"<unicode string>" would be desirable too. Some variatuins on U would give more control over the unicode encoding that's desired. For instance U for UTF8, uU for UTF16LE, Uu for UTF16BE, uUU for UTF32LE and UUu for UTF32BE? Just suggestions. Otherwise, what is simpler than breaking the string and using & to stitch the lines togeter? For once, Eu isn't needlessly verbose there. CChris
6. Re: Interpreter Mod We Can All Get Behind
- Posted by c.k.lester <euphoric at ckle?te?.com> Nov 21, 2007
- 635 views
Bernie Ryan wrote: > c.k.lester wrote: > > Bernie Ryan wrote: > > > And How about a line continuation symbol > > > Example: > > > "This is a long string that I want to continue on the next line __ > > > so I can just use the two underscores to continue it on this line" > > Why would you want that? Euphoria already ignores line breaks in code > > so you can do something like > > "This is a long string that I want to continue on the next line " > > & "so I can just use the two underscores to continue it on this line" > So I can do this which I think is less confusing: > > record("MyStructure", "__ > item1 long 1 __ > item2 pointer 1 __ > rect STRUCT RECT __ > item3 byte 10 > item4 uint 1 __ > ") > > Underscores are only allowed inside of identifiers. > If they are inside a string they would be ignored. What is an "identifier?" And you put them in a string in your example, so I still don't get it.
7. Re: Interpreter Mod We Can All Get Behind
- Posted by Jerry Story <story.jerry at gmail?c?m> Nov 21, 2007
- 647 views
c.k.lester wrote: > > How about block commenting? That would be awesome and could > significantly advance the cause for documenting code. > > /* > Some Topic Header > Some topic discussion. Blah blah blah. > */ Suppose you forget the */ Then some lines later you have another block comment. /* some commenting forgot */ some code /* more commenting */ Now you are wondering what the &^%$#@ is wrong with that code.
8. Re: Interpreter Mod We Can All Get Behind
- Posted by CChris <christian.cuvier at agriculture.gou?.f?> Nov 21, 2007
- 642 views
Bernie Ryan wrote: > > c.k.lester wrote: > > > > Bernie Ryan wrote: > > > And How about a line continuation symbol > > > > > > Example: > > > > > > "This is a long string that I want to continue on the next line __ > > > so I can just use the two underscores to continue it on this line" > > > > Why would you want that? Euphoria already ignores line breaks in code > > so you can do something like > > > > "This is a long string that I want to continue on the next line " > > & "so I can just use the two underscores to continue it on this line" > > > So I can do this which I think is less confusing: > > record("MyStructure", "__ > item1 long 1 __ > item2 pointer 1 __ > rect STRUCT RECT __ > item3 byte 10 > item4 uint 1 __ > ") > > > > > For string sequences, just use an editor that has word wrapping. :) > > > > Besides, it would be a pain to implement. What if my string sequence has > > a double underscore in it? > > Underscores are only allowed inside of identifiers. > If they are inside a sting they would be ignored. > > > Bernie > > My files in archive: > WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API > > Can be downloaded here: > <a > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a> This works, doesn't it? And what are the drawbacks?
record("MyStructure", " item1 long 1 "& " item2 pointer 1 "& " rect STRUCT RECT "& " item3 byte 10 "& " item4 uint 1 ")
The only issue I see is that you need something both at the end and at the beginning, while your scheme add something at the end only. I'm not against it, it hardly hurts, but this item would be low on my own priority list. CChris
9. Re: Interpreter Mod We Can All Get Behind
- Posted by Matt Lewis <matthewwalkerlewis at ?mai?.com> Nov 21, 2007
- 636 views
CChris wrote: > > Also U"<unicode string>" would be desirable too. Some variatuins on U would > give more control over the unicode encoding that's desired. For instance U for > UTF8, uU for UTF16LE, Uu for UTF16BE, uUU for UTF32LE and UUu for UTF32BE? > Just > suggestions. I think that you'd probably want to stick with (internally) the equivalent of wide characters (wchar) which are 4 bytes each. It pretty naturally aligns with the sequence. The only encoding issues would be in the files themselves, at which point, you're correct that we probably need some way to identify how things are encoded in the file. I'd suggest UTF8 as the best way to encode euphoria source, since most of the characters will be from ASCII, making UTF8 the most efficient. But if the scanner is UTF8 enabled, is there any real need to identify which strings are or are not unicode? Using sequences, there's no need to distinguish between char widths as with C/C++. This all assumes that the interpreter is capable of dealing with unicode. wxEuphoria now handles it pretty seamlessly, although, of course, if you use any funky characters, your strings will look kind of funny:
string = "This uses a unicode character: " & 2015
If we decide to go with UTF8 as the standard, we'll need to have a library (presumably in eu, for the front end) that is capable of decoding UTF8. And then, of course, there will be all sorts of decisions about how to handle puts/printf/etc. But if we go with straight wide chars, then it might actually make things a bit simpler, like it did with wxEuphoria (because I don't have to cast a long to a char). Not sure how all this would affect DOS, however. Matt
10. Re: Interpreter Mod We Can All Get Behind
- Posted by Matt Lewis <matthewwalkerlewis at g?a?l.com> Nov 21, 2007
- 636 views
Jerry Story wrote: > > c.k.lester wrote: > > > > How about block commenting? That would be awesome and could > > significantly advance the cause for documenting code. > > > > /* > > Some Topic Header > > Some topic discussion. Blah blah blah. > > */ > > Suppose you forget the */ > Then some lines later you have another block comment. <snip> > Now you are wondering what the &^%$#@ is wrong with that code. An editor capable of doing syntax highlighting will solve this for you almost immediately. Matt
11. Re: Interpreter Mod We Can All Get Behind
- Posted by c.k.lester <euphoric at ??lester.com> Nov 21, 2007
- 638 views
Jerry Story wrote: > c.k.lester wrote: > > How about block commenting? That would be awesome and could > > significantly advance the cause for documenting code. > > > > /* > > Some Topic Header > > Some topic discussion. Blah blah blah. > > */ > > Suppose you forget the */ > Then some lines later you have another block comment. LOL. That would be fun. :) Actually, use a color-coding editor and it won't mess you up. They do it that way in CSS and JavaScript.
12. Re: Interpreter Mod We Can All Get Behind
- Posted by Alan Oxley <fizzpop at axxes?.co.?a> Nov 21, 2007
- 642 views
> Suppose you forget the */ > Then some lines later you have another block comment. Yeah.. like when I left a fullstop out in some Cobol. I was *sure* the compiler interpreter had a bug! Very frustrating, wasted a few hours. Happened in PL/1 too, with block comments "/* comment */" . Lessons learnt. A syntax checker would show the problem yes. For me, I'll stick with beginning all comments with the standard two minus. My human scanner has no problem with that. By all means add the block comments, its a change that can be adopted or ignored as the individual sees fit. Thanks, Alan
13. Re: Interpreter Mod We Can All Get Behind
- Posted by Derek Parnell <ddparnell at bi?pond?com> Nov 21, 2007
- 650 views
Bernie Ryan wrote: > And How about a line continuation symbol > > Example: > > "This is a long string that I want to continue on the next line __ > so I can just use the two underscores to continue it on this line" The D programming language has the simple rule that adjacent string literals in the text are assumed to be a single literal. Thus your example would become ... "This is a long string that I want to continue on the next line " "so I can just continue it on this line" -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
14. Re: Interpreter Mod We Can All Get Behind
- Posted by CChris <christian.cuvier at ?gricultur?.gouv.fr> Nov 21, 2007
- 685 views
Alan Oxley wrote: > > > > Suppose you forget the */ > > Then some lines later you have another block comment. > > Yeah.. like when I left a fullstop out in some Cobol. > I was *sure* the compiler interpreter had a bug! > Very frustrating, wasted a few hours. Happened in PL/1 > too, with block comments "/* comment */" . Lessons learnt. > > A syntax checker would show the problem yes. For me, I'll stick with > beginning all comments with the standard two minus. > My human scanner has no problem with that. > By all means add the block comments, its a change that can be adopted > or ignored as the individual sees fit. > Thanks, > Alan Wouldn't ++ -- by itself on a line, with an optional comment whatever text you may come up with scanning several lines and which the @#}{} interpreter will happily ignore. You noticed that leading whitespace doesn't count. ++ -- again by itself with an optional comment be nice? Aren't we all using syntax highlighting when programming? It is not strictly necessary, of course - we could also code using a stiletto and clay tablets, after all. The highlighting will immediately tell you you are in a block comment. Coding technology has improved since the days of PL/1. CChris
15. Re: Interpreter Mod We Can All Get Behind
- Posted by Jason Gade <jaygade at y?hoo.com> Nov 21, 2007
- 638 views
CChris wrote: > Wouldn't > ++ -- by itself on a line, with an optional comment > whatever text you may come up with > scanning several lines > and which the @#}{} interpreter will happily ignore. > You noticed that leading whitespace doesn't count. > ++ -- again by itself with an optional comment > be nice? > > Aren't we all using syntax highlighting when programming? It is not strictly > necessary, of course - we could also code using a stiletto and clay tablets, > after all. The highlighting will immediately tell you you are in a block > comment. > Coding technology has improved since the days of PL/1. > > CChris Well, I usually use Vim. I guess that you could compare that with using a stylus and clay tablets ;) But I use it with syntax highlighting as well. For block comment, my vote would be this notation: --* block comment --* or even better: --/ block comment --/ Hmm. Yeah. I have no strong opinion as to whether it should implemented, but I like how that looks. I had been thinking of this as well: --/ block comment /-- Whichever. -- A complex system that works is invariably found to have evolved from a simple system that works. --John Gall's 15th law of Systemantics. "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.
16. Re: Interpreter Mod We Can All Get Behind
- Posted by Kenneth Rhodes <ken_rhodes30436 at ?ahoo.com> Nov 21, 2007
- 616 views
Jason Gade wrote: > Well, I usually use Vim. I guess that you could compare that with using a > stylus > and clay tablets ;) > > But I use it with syntax highlighting as well. Jason, would you share your Vim euphoria syntax file(s)? For some reason I never could get Jeremy Cowgar's to work for me... not sure why yours would be any different, but I thought I might give Vim a try again. I kinda like being able to do everything from the keyboard, but FAST. Ken Rhodes Folding at Home: http://folding.stanford.edu/ 100% MicroSoft Free SuSE Linux 10.0 No AdWare, SpyWare, or Viruses! Life is Good,
17. Re: Interpreter Mod We Can All Get Behind
- Posted by Jason Gade <jaygade at yaho?.co?> Nov 21, 2007
- 623 views
Kenneth Rhodes wrote: > > Jason Gade wrote: > > > Well, I usually use Vim. I guess that you could compare that with using a > > stylus > > and clay tablets ;) > > > > But I use it with syntax highlighting as well. > > Jason, would you share your Vim euphoria syntax file(s)? > For some reason I never could get Jeremy Cowgar's to work > for me... not sure why yours would be any different, but I thought I > might give Vim a try again. I kinda like being able to > do everything from the keyboard, but FAST. > > Ken Rhodes > Folding at Home: <a > href="http://folding.stanford.edu/">http://folding.stanford.edu/</a> > 100% MicroSoft Free > SuSE Linux 10.0 > No AdWare, SpyWare, or Viruses! > Life is Good, Try this: http://www.rapideuphoria.com/uploads/euphoria-vim.zip I've only used it on Windows though. This was originally written by Travis Beaty. I included filetype.vim -- just search it for "euphoria" to find the relevant section. Or include the entire file. Let me know if it works. -- A complex system that works is invariably found to have evolved from a simple system that works. --John Gall's 15th law of Systemantics. "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.
18. Re: Interpreter Mod We Can All Get Behind
- Posted by Kenneth Rhodes <ken_rhodes30436 at yahoo?com> Nov 21, 2007
- 630 views
Jason Gade wrote: > > Kenneth Rhodes wrote: > > > > Jason Gade wrote: > > Try this: > <a > href="http://www.rapideuphoria.com/uploads/euphoria-vim.zip">http://www.rapideuphoria.com/uploads/euphoria-vim.zip</a> > > I've only used it on Windows though. This was originally written by Travis > Beaty. > I included filetype.vim -- just search it for "euphoria" to find the relevant > section. Or include the entire file. > > Let me know if it works. > j. Thanks, Jason. No joy yet. I downloaded and installed vim7.1 and then copied the euphoria vim files to the relevant directories. I'll be fiddling with it some more. I'm probably missing something very simple. Ken Rhodes Folding at Home: http://folding.stanford.edu/ 100% MicroSoft Free SuSE Linux 10.0 No AdWare, SpyWare, or Viruses! Life is Good,
19. Re: Interpreter Mod We Can All Get Behind
- Posted by Pete Lomax <petelomax at bluey?nder.co?uk> Nov 21, 2007
- 645 views
Jerry Story wrote: > > c.k.lester wrote: > > > > How about block commenting? That would be awesome and could > > significantly advance the cause for documenting code. > > > > /* > > Some Topic Header > > Some topic discussion. Blah blah blah. > > */ > > Suppose you forget the */ Should not be a problem: If the compiler hits <eof> while still looking it should show eg: C:\mystuff\test.exw:11 /* Some Topic Header ^ Error: closing block comment not found. Rather than <eof>: error closing block comment expected, which I agree is totally useless in comparison. For this to work, block comments must be nestable, besides sooner or later you would anyway want to do something like:
/* <-- added today procedure x() /* <-- been here months Do this */ ... /* And that */ end procedure */ <-- added today
<shameless plug> Of course, Edita handles nested block comments like this no problem </shameless plug> BTW, Positive supports block comments and also "--/*", "--*/" & "--/**/", (see PS). However I then found line 30356 in win32lib was "--/* Begin Tone Skoda --" which it treated as an opening block comment with no matching end. The fix took a matter of seconds, none of which involved any kind of head scratching. (--/* --> --!/* forced it to be treated as a line comment). Regards, Pete PS The "--/*" forms are intended to be treated differently by Positive and RDS Eu, the latter of which should them as line comments.
20. Re: Interpreter Mod We Can All Get Behind
- Posted by Pete Lomax <petelomax at b??eyonder.co.uk> Nov 21, 2007
- 638 views
Bernie Ryan wrote: > Underscores are only allowed inside of identifiers. > If they are inside a sting they would be ignored. That would break Edita, and there must be plenty of other stuff in the archives with quoted underscores, so obviously I'm strongly against this. I would however accept a triple quote or backslash-just-before-the-newline solution. Obviously you and Mr Underscore have had some kind of falling out and you now think he is a useless character, but the rest of us still like him Regards, Pete
21. Re: Interpreter Mod We Can All Get Behind
- Posted by Bernie Ryan <xotron at blu?frog?com> Nov 21, 2007
- 637 views
Pete Lomax wrote: > > Bernie Ryan wrote: > > Underscores are only allowed inside of identifiers. > > If they are inside a sting they would be ignored. > > That would break Edita, and there must be plenty of other stuff in the > archives > with quoted underscores, so obviously I'm strongly against this. > > I would however accept a triple quote or backslash-just-before-the-newline > solution. > > Obviously you and Mr Underscore have had some kind of falling out and you now > think he is a useless character, > but the rest of us still like him > > Regards, Pete: How about // which would not require using the shift key when typing. Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
22. Re: Interpreter Mod We Can All Get Behind
- Posted by Juergen Luethje <j.lue at ?mx.d?> Nov 22, 2007
- 642 views
Bernie Ryan wrote: > Pete Lomax wrote: > > > > Bernie Ryan wrote: > > > Underscores are only allowed inside of identifiers. > > > If they are inside a sting they would be ignored. > > > > That would break Edita, and there must be plenty of other stuff in the > > archives > > with quoted underscores, so obviously I'm strongly against this. > > > > I would however accept a triple quote or backslash-just-before-the-newline > > solution. There is already '&' for concatenating (literal or other) strings. Introducing additional syntax for the same purpose will mainly add unnecessary confusion. > > Obviously you and Mr Underscore have had some kind of falling out and you > now think he is a useless character,</font></i> > > but the rest of us still like him > > > > Regards, > > Pete: > > How about // which would not require using the shift key when typing. Maybe this is the case on _your_ keyboard. This is not true e.g. on my keyboard. Regards, Juergen
23. Re: Interpreter Mod We Can All Get Behind
- Posted by Gary Shingles <eu at 53??i.co.nz> Nov 22, 2007
- 649 views
CChris wrote: > Other languages use """ (three double quotes) to start and end a verbatim > string > (ie no escape chars, line breaks, spacing and tabbing count). This is missing > in Eu. That's something I sometimes miss from Perl, the 'heredoc' syntax so that you can say (in Perlese): $text = <<"EOF"; This is the text. This is another line. Etc. EOF The difference with Euphoria is that you would never be able use the variable substitution possible in Perl so I don't often miss it in Euphoria. The other option I liked was the one Derek mentioned from D, automatically concatenating sequential character strings. Though I could see the possibility of a few missed spaces between words, but that would be a minor coding issue. eg "The quick brown fox" "eats lazy dogs for breakfast" is "The quick brown foxeats lazy dogs for breakfast" I do that with & concatenation anyway though That syntax doesn't really solve the variable substitution issue though too, so you would end up using sprintf with & anyway (unless the interpreter could recognise sprintf as a string, but that would get messy). Gary
24. Re: Interpreter Mod We Can All Get Behind
- Posted by Pete Lomax <petelomax at ?lueyonder.c?.uk> Nov 22, 2007
- 649 views
Btw, what is the deal with newlines in a triple quote? One thing I would probably use it for is help/messagebox text, which is always a right pain with the " and \n"& requirements, especially if they break your stride/concentration when explaining something difficult. In this case, I would want the newlines, is this what others expect? Eg """ one two three """ is "one\ntwo\nthree\n" not "one two three". Gary Shingles wrote: > > The other option I liked was the one Derek mentioned from D, automatically > concatenating sequential character strings. I have a couple of problems with that. 1) It is no easier to convert: The quick brown fox jumped over the lazy dog to: "The quick brown fox " "jumped over the lazy dog" than it is to convert it to: "The quick brown fox "& "jumped over the lazy dog" Obviously it gets messier when you've got dozens or hundreds of lines. Conversely, to triple quote is +6 chars total no matter how many lines. 2) If you write, say
constant words = {"ONE", "TWO", "THREE" "FOUR", "FIVE"}
then words[4] will be "FIVE". If anything, I'd prefer it to treat a missing comma as if it had found one. Regards, Pete
25. Re: Interpreter Mod We Can All Get Behind
- Posted by CChris <christian.cuvier at ?griculture.go?v.fr> Nov 22, 2007
- 642 views
Pete Lomax wrote: > > Btw, what is the deal with newlines in a triple quote? > One thing I would probably use it for is help/messagebox text, which is always > a right pain with the " and \n"& requirements, especially if they break your > stride/concentration when explaining something difficult. > In this case, I would want the newlines, is this what others expect? > Eg > """ > one > two > three > """ > is "one\ntwo\nthree\n" not "one two three". > That's what I expect from a "verbatim string". Exactly what <pre>...</pre> does in HTML. I didn't fully understand Gary's point about text substitution, very likely because I don't speak Perl. > Gary Shingles wrote: > > > > The other option I liked was the one Derek mentioned from D, automatically > > concatenating sequential character strings. > > I have a couple of problems with that. > 1) It is no easier to convert: > > The quick brown fox > jumped over the lazy dog > > to: > > "The quick brown fox " > "jumped over the lazy dog" > > than it is to convert it to: > > "The quick brown fox "& > "jumped over the lazy dog" > > Obviously it gets messier when you've got dozens or hundreds of lines. > Conversely, to triple quote is +6 chars total no matter how many lines. > > 2) If you write, say > }}} <eucode> > constant words = {"ONE", > "TWO", > "THREE" > "FOUR", > "FIVE"} > </eucode> {{{ > then words[4] will be "FIVE". If anything, I'd prefer it to treat a missing > comma as if it had found one. > Agreed. > Regards, > Pete
26. Re: Interpreter Mod We Can All Get Behind
- Posted by Gary Shingles <eu at 531p?.co.?z> Nov 22, 2007
- 651 views
- Last edited Nov 23, 2007
Pete Lomax wrote: > > Btw, what is the deal with newlines in a triple quote? > One thing I would probably use it for is help/messagebox text, which is always > a right pain with the " and \n"& requirements, especially if they break your > stride/concentration when explaining something difficult. Another one is large blocks of HTML or CSS if you want them embedded in the code (which I generally do). Even without variable substitution it would be handy as you could replace any text with a custom routine anyway. > In this case, I would want the newlines, is this what others expect? > Eg > """ > one > two > three > """ > is "one\ntwo\nthree\n" not "one two three". Yes, the former. The newline is definitely there since you can see its effect in the source. > Obviously it gets messier when you've got dozens or hundreds of lines. > Conversely, to triple quote is +6 chars total no matter how many lines. It depends on how easy it would be to implement in the interpreter, but if it is fairly trivial and with no great overhead I would be in favour of """. > 2) If you write, say > }}} <eucode> > constant words = {"ONE", > "TWO", > "THREE" > "FOUR", > "FIVE"} > </eucode> {{{ > then words[4] will be "FIVE". That's a compelling argument. I often forget to put a comma after something if I add lines to a constant declaration, and at least the interpreter catches it. In this case it would not be too obvious where the error was when it said "subscript value 5 is out of bounds, reading from a sequence of length 4". It's the kind of error you can spend half an hour looking for. > If anything, I'd prefer it to treat a missing > comma as if it had found one. Eek, no. I'd prefer it to say: Syntax error - expected to see possibly '}', not a character string "FOUR", ^ Gary
27. Re: Interpreter Mod We Can All Get Behind
- Posted by Gary Shingles <eu at 5?1pi.?o.nz> Nov 22, 2007
- 624 views
- Last edited Nov 23, 2007
CChris wrote: > > Pete Lomax wrote: > > is "one\ntwo\nthree\n" not "one two three". > > > > That's what I expect from a "verbatim string". Exactly what <pre>...</pre> > does in HTML. I didn't fully understand Gary's point about text substitution, > very > likely because I don't speak Perl. In Perl you can say (carrying on the HTML theme avoiding using tags): $week = 48; $author = "Gary Shingles"; $html = <<"EOF"; -HTML- -HEAD--TITLE-Weekly report for week $week.-/TITLE--/HEAD- -BODY- -H1-Weekly report for week $week.-/H1- -H2-Author: $author-/H2- EOF print $html; And it will do what you expect. But if you then say that $week = 49; it won't update $html, it only subsitutes once what is currently defined. In that sense using sprintf is better (in Perl I generally search and replace tokens, like __AUTHOR__, __WEEK__ etc on templates). My point is though that you could never do this with Euphoria since variable names are unadorned, that is there is nothing to distinguish that it is a variable or a word within a string. I'm also not saying this is a bad thing. Perl is Perl and Euphoria is Euphoria Perl has a shell heritage where using something like $app = "$EUDIR/bin/$appname"; is natural whereas Euphoria stems from the more formal procedural languages. So in summary, while I am in support of triple quotes for large strings I can just see that its use will be limited. Gary
28. Re: Interpreter Mod We Can All Get Behind
- Posted by Alan Oxley <fizzpop at axxess.?o?za> Nov 23, 2007
- 627 views
How about if we could define the chars we wanted to be seen as comments: with comment_indicator "--" with comment_indicator "//" with comment_indicator "~" This directive to be specified once only, and the euphoria parser will say there was an error if specified more than once. But keep the "--" as allowed for backwards compatibility. Regards Alan
29. Re: Interpreter Mod We Can All Get Behind
- Posted by CChris <christian.cuvier at agric?lture.g?uv.fr> Nov 23, 2007
- 643 views
Alan Oxley wrote: > > How about if we could define the chars we wanted to be seen as comments: > with comment_indicator "--" > with comment_indicator "//" > with comment_indicator "~" > > This directive to be specified once only, and the euphoria parser will > say there was an error if specified more than once. But keep the "--" > as allowed for backwards compatibility. > > Regards > Alan I hope you mean "once per file". Otherwise, see what happens when you include two files that have a different value for the directive... CChris