lua-users home
lua-l archive

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


 > > No it's not.  I've written too much "\x -> x * (x-1)" to be satisfied
 > > with standard Lua syntax.  This syntax, from Haskell, looks
 > > like line noise only if you've never seen lambda calculus.
 > 
 > And other line noise looks like line noise only if you've never seen C.
 > Or BNF.  Or Python.  Or Perl.  Or awk.  Or ada.  Or APL.  Or Scheme.

Come on, David---be fair.  Lambda calculus occupies a privileged
position.  Unlike Python, Perl, or APL, lambda calculus is 70 years
old, and it is the lingua franca of the functional-programming community.
People who are *interested* in programming with first-class functions
either are already familiar with lambda calculus or will soon learn
about it.

 > > Look at the information design: in the standard Lua example you give,
 > > there are 30 characters of which 8 are unique to this particular
 > > function, and the rest are syntactic noise.  The Haskell version is 15
 > > characters with 10 unique ones, or if you compress to "\x -> x*(x-1)"
 > > (apples to apples), 13 characters of which 8 are unique to the
 > > function.  The information density for the Haskell syntax is much
 > > higher.
 > 
 > Information density is not a Lua design goal.  Use APL if you are
 > concerned about that.

I agree that Lua's goal is not to *maximize* information density.  
I believe Lua's goal is *appropriate* information density: there
should be enough keywords to guide beginners, but for experts, there
is not too much syntactic noise.  And I do think that in the case of
anonymous functions, Lua's design is out of balance: there is more
syntactic noise than is really tolerable, and what's going on is not
particularly helpful for beginners.

 > So you are frustrated that Lua is not Haskell or Scheme...

Kindly do not put words in my mouth.

 > I would be frustrated when Lua were not Lua.

But Lua is a moving target!  Over the course of its lifetime, Lua has
changed radically.  Do you want to return to upvalues with '%' syntax?
The introduction of lexically scoped closures was a serious change in
the language, and I think it unfortunate that this change was not
accompanied by a reconsideration of the syntax and the libraries in
light of this new feature.

I do not advocate for introducing Haskell syntax into Lua.
But I do advocate for more thought going into how Lua could be changed
the better to support functional programming---while remaining Lua.
Lua's design (and Roberto's book) show evidence of great effort put
into supporting object-oriented styles of programming in Lua.
I think it reasonable to ask that comparable effort be invested in
supporting functional styles of programming---while keeping Lua Lua.


Norman