4 ms·
> type hints which are required (I think) Only in strict mode; in partial or decl mode, you can leave off the annotations. In fact, a large fraction of PHP fil
by jwatzman 13y ago
> type hints which are required (I think)
Only in strict mode; in partial or decl mode, you can leave off the annotations. In fact, a large fraction of PHP files are also valid Hack files in partial mode. The article has a decent explanation of the modes, and see http://docs.hhvm.com/manual/en/hack.modes.php http://docs.hhvm.com/manual/en/hack.modes.php for our official documentation.
> Technically HHVM can run projects that are a mix of PHP/Hack, but I wouldn't recommend that. Mixing your codebase is worse for portability, in my opinion, as implementors are more likely to implement just Hack than Hack + PHP.
I'm not sure I understand your argument here. Hack was designed to be seamlessly used in a mixed PHP/Hack codebase. Facebook itself is still in such a mixed state, and will likely remain so for the foreseeable future; we've gotten a ton of benefit from converting most of our code, but there's a long tail that's just not worth pushing through all at once.
- trebor 13y agoSounds like it's better than I thought. > I'm not sure I understand your argument here. Hack was designed to be seamlessly used in a mixed PHP/Hack codebase. My argument is that if another person/organization implemented a Hack runtime it'd most likely be Hack-only, not Hack + PHP. As you can see, I don't mean in HHVM itself but in potential 3rd party implementations. So software written to run in a mixed Hack mode now, may not be supported in the future with other interpreters. I'm still interested in trying Hack, in spite of that opinion.
- ZeroGravitas 13y agoBut this sharing is all one way? So Hack can make use of PHP libraries but not vice versa? And when you say PHP files are valid Hack files, you mean without any change? So the <?hh rather than <?php is optional?