[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: '__iter', yet again!
- From: spir <denis.spir@...>
- Date: Wed, 16 Dec 2009 19:41:44 +0100
Jerome Vuarand <email@example.com> dixit:
> 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.
...but your argument applies to _all_ metamethods / overriding. What differs in the case of __call, __tostring or __add? For..in is a builtin operation on a table/object that, unlike others, lacks a matching metamethod.
Or do I misinterpret your meaning?
PS: Where are you from?
la vita e estrany