[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lightweight syntax: a dissident view
- From: Axel Kittenberger <axkibe@...>
- Date: Wed, 24 Nov 2010 11:14:51 +0100
> 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.
select(x, tableA.foo, tableB.foo, tableC.foo)
So we have this:
selectF(x, function() return tableA.foo end, function() return
tableB.foo end, function() return tableC.foo end)
wouldn't these be more readable? Say,
selectF(x, (<=tableA.foo), (<=tableB.foo), (<=tableC.foo))
or
selectF(x, \(tableA.foo), \(tableB.foo), \(tableC.foo))
?