lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Philippe Lhoste wrote:
Just one thought:

Block comments and literal strings are mostly meant for enclose large number of lines (less for literal strings that are useful, amongst other strings, to enclose Dos paths). At least, that's where there is the most likely potential problems.

Literal srings have already some conventions, like if they start by a new line, it is not enclosed in the string.

Why not make another convention, like starting (some) multiline block comments (literal strings) with --[[[ ([[[) anywhere in a line and ending them with ]]] (or --]]] as it is convenient) only at the start of line, a bit like the Perl/PHP HereDoc?

It lifts a lot of potential problems, as we rarely find code like:

val = t[a[f[i
]]] * 2;

aren't we?

Or, if really we want to take care of all cases, we can use the HereDoc syntax:

longText = [[TERMINATOR
blabla
...
42
...
foo bar
TERMINATOR]];	-- Always at start of line

--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://Phi.Lho.free.fr
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--