News for hackers. Stuff that matters.
Re:PHP 7's new hashtable implementation by Elv13 on Tuesday December 23, 2014 @03:18AM (#8787284)
Lua also have hybrid array, maps and object. It does work well when implemented in a sane way. Lua has different way of iterating the table if you want an array or maps.
Re:PHP 7's new hashtable implementation by stdbrouw on Tuesday December 23, 2014 @04:06AM (#8787375)
... though I wouldn't necessarily call Lua's way of doing things "sane". E.g. if Lua encounters a `nil` somewhere in your table, it will stop iterating.
Re:PHP 7's new hashtable implementation by joeyo on Tuesday December 23, 2014 @05:07AM (#8787520)
It's certainly sane in the sense that it was an intentional, if perhaps unusual, design decision. I personally like it since it results in an efficient implementation of sparse arrays.

In any event, Lua 5.2 will respect the __len, __pairs and __ipairs metamethods, so you can tweak this behavior if you need to store nils in your tables and iterate over them.

Re:PHP 7's new hashtable implementation by stdbrouw on Tuesday December 23, 2014 @07:28AM (#8787860)
The world would be a beautiful place if everything intentional were sane :-) It's bitten me a couple of times (e.g. when unpacking arguments in a function to feed them to another function, where one of the arguments is nil) but I can see how it could be the desired behavior in some cases.