lua-users home
lua-l archive

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


Doug Rogers wrote:
Just not the latter, */.

What about the following C++ code?
 a = b *//this is a one-line comment
     2;


Touche! That *could*// happen in real code.

Whatever the Lua management decides is fine by me. I'm like the others. I think something simple and easy is best, even if it means that under extreme conditions it won't work. I just want it to work properly in common cases. To me, ']]' is common enough to warrant concern.

Nesting isn't such a big issue for me. We each have our own tastes.

Neither for me. If I verbalized some concerns about syntax-highlighting being more difficult (but far, far from the complexity of the Perl lexer...), obviouly it wasn't to influence design choice (that's what I tried to mean by the clumsy sentence "this concern isn't the problem of Lua authors"). Whatever the final choice, we will adapt.

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?

It is simple (no need to check content to know how many starts to put, compatible with old syntax (unlike some proposals seen here), nicely consistent, and quite idiot proof.

What do you think? Any booby trap?

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