lua-users home
lua-l archive

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

> What puts me off from the current spate of lightweight syntax
> proposals is just the same thing I hate about C and Perl: they
> are cryptic and the saving in keystrokes now is not worth the
> brain pain later.

If anybody is out to save keystrokes, you are right, this is completly
the wrong track that wrecked so many languages already.

> The only lightweight syntax I would be prepared to support is one
> that is in Pascal but not in Lua: s[i] == s:sub(i,i) for strings,
> not because it saves six characters, but because it enhances
> readability.

Thats exactly what IMHO the light-function-syntax proposals are about,
its about readability. Since if you like to code with a few lambda's
code piles up that might be better readable otherwise. I agree many of
the proposals might make things worse, and I'm not sure about if I
really want my own propals :-) And I only like to discuss about it,
since it is ambigous and not as clear as continue ;-)

But take for example a replacement function for select() call it
selectF, it takes lambdas as arguments so they are only evaluated if
an argument is really selected.

Right now in default Lua this works, but as far i realized it will
evaluate tableB and tableC as well even if select is 1, and thus fail
if they are nil.

So we have this:

selectF(x, function() return end, function() return end, function() return end)

wouldn't these be more readable?  Say,

selectF(x, (<, (<, (<


selectF(x, \(, \(, \(