News for hackers. Stuff that matters.
Re:The Future of HHVM by krapp on Monday September 18, 2017 @09:39PM (#15281176)
I'm just annoyed that PHP doesn't handle HTML tags natively as their own distinct entities. Not having to quote HTML as strings or switch into and out the rendering context with PHP tags makes templates a lot easier to reason about and cleaner. With that, you can natively get features like auto-escaping, HTML tag validation, extending or creating custom tags, template inheretance, all of which you can do in PHP but only if you include the overhead of a framework.
Re:The Future of HHVM by grzm on Monday September 18, 2017 @11:08PM (#15281493)
> I'm just annoyed that PHP doesn't handle HTML tags natively as their own distinct entities.

I'm interested in things like this as well. Can you provide an example of what you're thinking of? Something like JSX? Other data structures that are transformed into HTML by a library? The latter seems to be counter to your argument about requiring the use of some framework or library, but I can't think of any alternatives off the top of my head.

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);
    }
[0]https://pastebin.com/m54VDwNY
Re:The Future of HHVM by grzm on Tuesday September 19, 2017 @11:32AM (#15285523)
Thanks for the example!