String delimiters [WAS Re: common code patterns]

Monte Goulding monte at appisle.net
Mon Aug 14 17:33:12 EDT 2017


> On 15 Aug 2017, at 5:22 am, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> put {{
> That's better!
> A really readable and short
> version that I can deal with.
> }} into temp

It’s really unlikely we would use { } because one day we will want to implement array literals. You know one time I messed with the server tag code in the parser so that reverse server tags could be used for this ;-)

http://forums.livecode.com/viewtopic.php?f=66&t=25339 <http://forums.livecode.com/viewtopic.php?f=66&t=25339>

That of course would never pass the sniff test!

Anyway, if I might propose an alternative of allowing the line continuation char (which happens to be escape) within strings. The sequence \ & return & <any number of spaces> would be replaced with just return in the string.

Something like this:

put “foo\
         bar”

would put:

foo
bar

Of course if you need leading whitespace then that’s a bit trickier but the above could be relatively easily implemented in both the script editor and the parser.

Cheers

Monte


More information about the use-livecode mailing list