On Sat, Apr 21, 2012 at 06:09:11AM +1200, Ralph Versteegen wrote:
> I added \n support to HSpeak the other day on Charbile's request, but
> should have gone all the way and added multiline string constants.
>
> I think I'll just go with """ to begin and end such a string
>
> But I'm not sure how to handle indentation. Lots of languages have
> multiline strings, but handle indentation and leading/trailing
> newlines differently. Some have complex rules which never work in all
> cases, and some parse the string verbatim. I've never seen a style I
> was happy with, so was wondering where someone else thinks there IS a
> One True Way.
>
> I'm worried, of course, about scripts ending up looking like this:
>
> script, foo, begin
> ...
> new textbox("""Mr. Miyagi:
> There is a store down the street. Sells lots of stuff. Start there."""
> , 4, align:center, align:bottom)
> wait for textbox
> new textbox("""Buck Star:
> Yes sensai Danielsan.""", 4, align:center, align:bottom)
> wait for textbox
> ...
>
> Whereas something like this might be nicer:
>
> new textbox("""
> Buck Star:
> Yes sensai Danielsan."""
> , 4, align:center, align:bottom)
My personal opinion is that if you can, it would be best to copy
python's behavior as closely as possible... However I also think that
anybody who is using multiline string constands just has to accept as a
fact of life that they are going to look odd in the code flow, so if a
python-clone iplementation is too much work, I think you should go with
the simplest possible implementation:
new textbox("""Buck Star:
Yes sensai Danielsan.""", 4, align:center, align:bottom)
wait for textbox
...
And users will just have to live with it.
Also, question: is this just for the new real strings? or will this also
apply to the old hacky strings?
$0="""Buck Star:
Yes sensai Danielsan."""
---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org