lua-users home
lua-l archive

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

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

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.