lua-users home
lua-l archive

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

>Otherwise, the first thing that would have happened is people would
>have started writing their own ipairs ;)

> steve d.

And what would be wrong with that? It would take a lot of the heat out of
debates like 1-base arrays if everything in the libraries that can be
adequately implemented in Lua was taken out and, for compatibility,
re-implemented as a Lua library. Dirk Laurie and I had a go at re-writing
the Table library, but eventually came to the conclusion that we ought to be
working in Lua not C. Everything except Sort and Unpack can be done as well
or even better in Lua and even Sort and Unpack might be better as a C core
wrapped in Lua for handling optional parameters and the like.

And the __pairs and __ipairs metamethods are unnecessary since anyone who
wants to redefine pairs and/or ipairs (including to implement metamethods)
can just replace the functions with their own implementations (in Lua). I
still think the approach implemented in my "Self-iterating Tables"
PowerPatch is a much more useful innovation.