EnTerr
10 years agoRoku Guru
Multiline string literals for B/S?
I find myself wanting that multiline string literals be supported in BrightScript - instead of manually assembling with `+ chr(10) +`. As simple as:
As somebody who's written interpreters i know it's not hard to implement. I imagine there might be concern of missing-quote error rolling down - but note above is now a supported syntax in VB, so such fear is greatly exagerrated https://github.com/dotnet/roslyn/wiki/N ... g-literals
I contemplated Python's:
There is also Perl-style here-doc (PHP edition):
There is attractiveness in "heredoc" in that there will be no need to escape quotes (") nor anything else if say including code - just select good marker and copy&paste between. Frankly this seems more and more desirable for my purposes.
Then there is the "cuckoo" operator (qq)... yeah, further alternatives head downhill in attractiveness.
x = "Hello,
World!"
As somebody who's written interpreters i know it's not hard to implement. I imagine there might be concern of missing-quote error rolling down - but note above is now a supported syntax in VB, so such fear is greatly exagerrated https://github.com/dotnet/roslyn/wiki/N ... g-literals
I contemplated Python's:
x = """Hello,but alas that ship has sailed due to double-quote escape (i.e. tripple-quote """ is ambiguous if it's a literal with 1st char being a quote, or a multi-liner start). Tripling apostrophe may work but doesn't sound very BASIC (singular, it's used as REMark)
World!"""
There is also Perl-style here-doc (PHP edition):
x = <<<END
Hello,
World!
END
There is attractiveness in "heredoc" in that there will be no need to escape quotes (") nor anything else if say including code - just select good marker and copy&paste between. Frankly this seems more and more desirable for my purposes.
Then there is the "cuckoo" operator (qq)... yeah, further alternatives head downhill in attractiveness.