[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Operators on functions
- From: "Pierre Chapuis" <catwell@...>
- Date: Wed, 20 Nov 2013 14:49:17 +0100
> On Wed, Nov 20, 2013 at 12:04 PM, Pierre Chapuis <catwell@archlinux.us>
> wrote:
> (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.)
Idiomatic Moonscript code (if that exists) is probably more
functional and "clever" than Lua. But I am not sure that this
is always a net win.
For instance, take this. Can you guess what this does?
https://github.com/leafo/lapis/blob/07f9f1f5dce4af060fe8445d6f18a522e0c1af97/lapis/util.moon#L270-L274
Yes, this is clever. And error-prone:
https://github.com/leafo/lapis/issues/32#issuecomment-23954660
I would almost always rather have slightly longer, boring but
straightforward Lua code.
--
Pierre Chapuis