lua-users home
lua-l archive

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


On Thursday 17 June 2004 23:40, Luiz Henrique de Figueiredo wrote:
> When we discussed long comments, some people said they didn't need them
> because their editors could do it easily. If it works for you, that's fine.
> But the syntax comes from a marriage between long strings and comments:
>         --[[ ... ]]
> The idiom
>         --[[
>                 ...
>         --]]
> makes it easy to turn it off and on by simply adding or removing a '-'
> in the first line. I think there's a page on the wiki that discusses this.

Sorry if this was already mentioned here, one minor nit I never understood is 
why the long syntax comment isn't --[[ ]]-- instead, since the --[[ ]] lends 
itself to the quite common pitfall:

--[[
   x[y[z]]=w
]]

The above fails because the comment ends at the equals sign. Obviously in the 
case example one could use x.y.z, but for other kinds of expressions the 
bracket syntax is preferrable. I end up writing x[y[z] ], which brings me bad 
memories of templates in C++.

-- Hisham