[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: '__iter', yet again!
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 16 Dec 2009 15:04:25 +0100
2009/12/16 John Hind <firstname.lastname@example.org>:
> I really cannot see why this solution is resisted – it is fully backward
> compatible and syntactically uncomplicated. The context of the explist is
> easily distinguishable being bracketed by the reserved words ‘in’ and ‘do’.
The beauty of the language, is that it has very few concepts, used in
many places. Rather than having a specific mechanism to iterate over
objects, the for loop use the mechanisms of multiple return values and
first class functions. The resistance comes from the fact that you
want to make Lua more complicated, just to save an explicit method
call. And that's assuming that the implicit __iter is better syntax
than an explicit method, which is arguable (e.g. I would disagree with
you). And concise and cryptic syntax overriding isn't even part of OO,
it's just often bundled with it.