|
On Sep 14, 2009, at 5:26 AM, steve donovan wrote:
On Mon, Sep 14, 2009 at 2:16 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:One important reason for not having "set:values" is that it'd be sugarfor "function (...) return set:values(...) end" and this would imply the creation of a hidden closure.Yes, it did feel like an incompatible proposal. So, is there some support for Mark Hamburg's closure sugar in Rio ;) ?
To be fair, though I'm not sure to whom, I think someone promoted it before I did. ;-)
But the full details of my proposal included: 1. Binds early.2. Binds strongly. (Weak closures are a separate implementation problem.) 3. Only generates a closure when not used at a call site though this should be purely an optimization.
The piece of syntax I will take credit for promoting since I don't think I'd seen it elsewhere before is:
obj:[method](...) and in this case: obj:[method]Thereby allowing the method name to be an expression while at the same time not forcing the repetition of obj in an expansion of the colon operator.
I believe this is actually moderately easy to implement as a patch on the current Lua implementation. (I'd have to go find my notes on how to do so.)
Mark