Hacker News new | past | comments | ask | show | jobs | submit login

> The Hack type system, particularly the ability to express nullability, is just vastly superior.

I agree the type system is superior, given the language was created to have a type system in the first place (PHP was not).

But PHP has allowed nullable types in syntax since PHP 7.1.

> Named parameters are an interesting one. The Hack equivalent is to use shapes

Hack shapes are not Hack’s answer to named parameters. Instead they’re a way to specify dict contents on a more granular level. A comparable array shape type, expressed in docblock form, is now supported by all major PHP static analysis software.

> Take match expressions plus enums. Incredibly useful. You know what's even more useful? When it's a type error to leave out one of the values.

Most PHP static analysis tools give you this information.

> I also find the Hack collection types (vec, keyset, dict) to be superior to PHP's array with more obvious semantics and less weird type coercion.

Absolutely agree with this, but for now (and maybe in perpetuity) we’ll have to settle for the swiss-army-knife array type.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: