Re:The Future of HHVM
by krapp on Tuesday September 19, 2017 @05:44AM
(#15283084)
XHP templates in Hack do wind up looking a lot like JSX (which is probably not coincidental).. Each tag is a class with a render function that returns an XML node. Here is an example base document template[0] showing what that looks like. Obviously, PHP templates can accomplish the same thing, it just takes more work and more dependencies to magic away the noise.
But with XML as a native data structure you can do things like typehint a tag:
public function setTitle(:document:base $base, string $title): void
{
$base->setAttribute("pagetitle", $title);
}
But with XML as a native data structure you can do things like typehint a tag:
[0]https://pastebin.com/m54VDwNY