lua-users home
lua-l archive

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


> 1.  This has probable come up before, but why doesn't Lua have more
> standard comment types (-- always seems like either a hyphen, dash or
> decrement to me), including a block comment ability like /* */.  Is the
> "$if nil" mechanism completely like #if 0, or does it still parse the
> code inside the block?

Haha! Excuse me, but I find the question quite strange. What is "standard"
for you? It seems that every programming language came up with a new way of
commenting lines:
// Comment
REM Comment
' Comment
; Comment
# Comment
etc.
There is no standard, and you will probably be quicly accustomed to it.
Well, upon reflexion, this question isn't so strange because I recently
asked why the .. notation for concatenating string, and no more "standard" + or
&. The answer was more or less "for aesthetic reasons", which seems perfectly
reasonable :-)

The $if mechanism is obsolete, unless you are still using the 3.2 version.
To those which were missing it, Roberto replied that we can put a block of
code between if nil then ... end, but of course, it is not the same thing
since Lua still parses the excluded block, and chokes on syntax errors.
In C, we can comment out partially written code, full of syntax errors, with
#if 0: the preprocessor skips them.
But in Lua, you can't do it.
Or use advanced capabilities of your editor to automatically comment out a
range of lines of code.

Perhaps a block comment would be nice, but of course it should allow
embedded comments, to avoid the pitfall of C block comments.

Regards.

-- 
--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--

Sent through GMX FreeMail - http://www.gmx.net