[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ipairs in Lua 5.3.0-alpha
- From: Coroutines <coroutines@...>
- Date: Mon, 4 Aug 2014 19:16:57 -0700
On Mon, Aug 4, 2014 at 6:44 PM, Tim Hill <drtimhill@gmail.com> wrote:
> As for __pairs() and __ipairs(), to my mind pairs() and ipairs() should always have been generic algorithms with (perhaps) the ability to over-ride. Which, of course, brings up the question of table.sort() .. is this now really a generic sort, and thus actually a global function hiding, somewhat arbitrarily, in the table library? You can see where this is headed, I’m sure: “sortable” things are items that implement the necessary metamethods. I don’t know if i like this, but that seems to me the way things are drifting as Lua makes more consistent use of metamethods.
1) I don't like raw*() -- I wish we had a debug.raw(self, metamethod_name)
2) I wish __pairs/__ipairs were added back, I also want __type, and
__sort -- while still having the ability to override the __sort with
the method passed to table.sort() as the 2nd arg, and a __next would
be awesome for C objects exposed to Lua
3) I wish __call were respected if you give the function type a
metatable, and basic C operations were exposed to Lua, like
getmetatable(0).__add = <C function to add 2 numbers>
I am off-topic and wanting :(