lua-users home
lua-l archive

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


Philipp,

> When using the `pairs` function, I expect getting pairs. An iterator factory for keys only would better be called `keys()`. Implementation-wise it could look for a `__keys` metamethod for those performance critical cases and fall back to the `pairs` protocol but dropping the second value.

Not sure we should introduce a separate metamethod for that, would be nice to check memory usage/processing overhead in these cases. BTW while we're discussing all of this, pairs() seems to pass only 1 argument to __pairs, but I didn't suggest changing *that*.

Best regards,

--
DoubleF