[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: deprecating 'for x in t'
- From: Rici Lake <lua@...>
- Date: Mon, 1 Nov 2004 13:07:35 -0500
On 1-Nov-04, at 12:43 PM, Lucas Ackerman wrote:
I would like to see this resolved as well. Either officially kill it,
give a compiler option to dissallow it (probably not good to fragment
language base), or make it syntactic sugar for 'for x in pairs(t)', so
that it always goes through the pairs function.
It is not a compiler issue, as I see it. The syntax:
for k in iterator, object, current do
is all the compiler knows about.
The latter option is my
preference, as it allows us to override the default table iteration in
clean way, short of the metatable __pairs ideas (which of course don't
address the basic 'for' issue for regular meta-free tables).
The proposal I posted a few hours ago does cover regular meta-free
(by doing the same thing as the current standard pairs function). A
implementation, which ignored the possibility of tables with __call
metamethods, would have simply used the standard pairs function.