lua-users home
lua-l archive

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




2011/6/14 Lorenzo Donati <lorenzodonatibz@interfree.it>
On 14/06/2011 0.32, Roberto Ierusalimschy wrote:
If the start character must be something unused in Lua, there are
few alternatives among ASCII: #, $, |,&, ?, !, `.

Actually it can be a new token, as Tony suggested. For instance, Ada
uses the syntax<<label>>.


Probably the best bets are # and $, since the other may better serve
as operators in Lua 9.5 :-P :-)

Should<<  and>>  be reserved for 9.5? :)

-- Roberto



...
goto continue
...
<<continue>>

Well, much better than @continue: (the more I see that colon, the more I hate it. I really feel it doesn't belong there).

If colons have to be used, I think

::continue::

is much better and doesn't clash with future uses as operator (well, not counting the C++ static scope operator, or however it is called).

It is symmetric and bulky. It doesn't misleadingly point backwards or forwards. Clearly marks a point in the code and, well, it brings to mind a real label or price tag!


Or, makes goto jumps into a local variable's scope:

for i = 1, 10 do
    if i % 2 == 0 then goto continue end
    print(i)
    local continue
end

is that OK?