[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Operators on functions
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 20 Nov 2013 12:29:56 +0200
On Wed, Nov 20, 2013 at 12:04 PM, Pierre Chapuis <catwell@archlinux.us> wrote:
> I tend to agree. *Some* functional ideas are welcome in Lua,
> for instance I consider defining a map() function and using
> it with pure functions (e.g. tostring) idiomatic.
Totally. There is a 'functional style' which Lua is good at, but one
doesn't have to insist on immutable data. Certainly having proper
closures is a fantastic thing for that style. It's sometimes useful
to have partial application as an operation, but whether that
operation is frequent enough to need an operator shorthand is another
question.
(An example of Moonscript implementing a lua-l request is the
treatment of the colon operator, which is '\' in Moonscript (still
feels like an escape to me, but colon was out for other reasons).
That is, a\foo(arg) translates to a:foo(arg), but a\foo without args
is an expression returning a partial application where the self is
bound - useful for callbacks.)