[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I miss table.foreach
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 5 Sep 2013 09:15:55 +0200
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...