lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Dec 16, 2009 at 2:27 PM, John Hind <> wrote:
> So we are back were we started (or have I missed something?) – what is
> needed is a new metamethod which is invoked when the explist of a generic
> for fails to resolve a function in its first slot. The object designer could
> put an iterator factory function in this slot which can return any form of
> iterator including stateless.

Not the first time either ;)   Mostly we end up with an explicit iter() method.

It is reasonable enough to expect something like __iter to be used by
for, although the detailed semantics could be tricky.  Should __iter
take precedence over __call?

I totally agree that using __call in this case is abuse of the concept
of 'callable'

steve d.