logoalt Hacker News

yuliyplast Monday at 2:49 AM1 replyview on HN

In Hack, collection objects were one of the biggest early mistakes that the took a huge amount of effort to undo. It turns out that the copy-on-write semantics of PHP array were extremely important for performance and good APIs. Being able to pass arrays to things without fear of mutation allowed for tons of optimizations and not needing to copy things just in case. This is why Hack switched to using `dict`, `vec`, and `keyset` rather than collection objects.

More generally, it's weird to see a whole blog post about generics for PHP not even mentioning Hack's generics designs. A lot of thought and iteration went into this like 5-10 years ago.

See https://docs.hhvm.com/hack/arrays-and-collections/object-col... and https://docs.hhvm.com/hack/arrays-and-collections/vec-keyset...


Replies

maxlohlast Monday at 5:14 AM

I thought Hack is dead or not intended for public use anymore.

But after some quick checking, I learned that Hack is still actively maintained, surprisingly.

show 2 replies