1. Interpreter Mod We Can All Get Behind

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>

new topic     » topic index » view message » categorize

2. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Interpreter Mod We Can All Get Behind

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?

new topic     » goto parent     » topic index » view message » categorize

4. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: Interpreter Mod We Can All Get Behind

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.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Interpreter Mod We Can All Get Behind

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.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

9. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

10. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

11. Re: Interpreter Mod We Can All Get Behind

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.

new topic     » goto parent     » topic index » view message » categorize

12. Re: Interpreter Mod We Can All Get Behind

> 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

new topic     » goto parent     » topic index » view message » categorize

13. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

14. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

15. Re: Interpreter Mod We Can All Get Behind

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.

new topic     » goto parent     » topic index » view message » categorize

16. Re: Interpreter Mod We Can All Get Behind

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,  smile

new topic     » goto parent     » topic index » view message » categorize

17. Re: Interpreter Mod We Can All Get Behind

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,  smile

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.

new topic     » goto parent     » topic index » view message » categorize

18. Re: Interpreter Mod We Can All Get Behind

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,  smile

new topic     » goto parent     » topic index » view message » categorize

19. Re: Interpreter Mod We Can All Get Behind

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 smile
</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.

new topic     » goto parent     » topic index » view message » categorize

20. Re: Interpreter Mod We Can All Get Behind

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 smile

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

21. Re: Interpreter Mod We Can All Get Behind

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 smile
> 
> 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

new topic     » goto parent     » topic index » view message » categorize

22. Re: Interpreter Mod We Can All Get Behind

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 smile
> > 
> > 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

new topic     » goto parent     » topic index » view message » categorize

23. Re: Interpreter Mod We Can All Get Behind

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 smile

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

new topic     » goto parent     » topic index » view message » categorize

24. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

25. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

26. Re: Interpreter Mod We Can All Get Behind

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",
                    ^
smile

Gary

new topic     » goto parent     » topic index » view message » categorize

27. Re: Interpreter Mod We Can All Get Behind

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
smile  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

new topic     » goto parent     » topic index » view message » categorize

28. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

29. Re: Interpreter Mod We Can All Get Behind

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu