[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: New long comments in 5.1
- From: Philippe Lhoste <PhiLho@...>
- Date: Sat, 19 Jun 2004 16:24:27 +0200
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;
Or, if really we want to take care of all cases, we can use the HereDoc
longText = [[TERMINATOR
TERMINATOR]]; -- Always at start of line
Mmmm, not so bright, it is incompatible with simple use of this string,
path = [[C:\Good Languages\Lua\Bright Script.lua]]
unless we make additional rules like:
Single line literal strings/comments use old syntax, multiline ones
always starts with new line or HereDoc terminator.
Or we use foo = [[[TERMINATOR
but I like it less (more exceptions).
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist