lua-users home
lua-l archive

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


On Thu, Sep 5, 2013 at 9:06 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> you are right, of course. But what Lua does to the first of those
> expressions is to try to call it.

And that's indeed the problem; if an object has __call defined, then
it will use that.  If __iter is defined, that would be tried first.

So we would get a clear notation for objects which are 'list-like' and
define __iter as a iterator constructor.

for x in obj do: print(x) end

Python envy?  We should be not too afraid of what Python does; I think.

This is something that would give 5.3 a definite increase in expressiveness...