[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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
the
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
end
is all the compiler knows about.
The latter option is my
preference, as it allows us to override the default table iteration in
a
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
tables
(by doing the same thing as the current standard pairs function). A
simpler
implementation, which ignored the possibility of tables with __call
metamethods, would have simply used the standard pairs function.
R.