Re: RFC about automatic template escaping
| From: | Fred Emmott | Date: | Tue, 29 Mar 2016 18:57:07 +0000 |
| Subject: | Re: RFC about automatic template escaping | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91995@lists.php.net to get a copy of this message | ||
Hi - I’m currently the maintainer of facebook/xhp-lib; as XHP’s been mentioned a few times here,
if someone’s interested in making a PHP7 version:
- while I won’t be able to directly work on a PHP7 port, I’ll be happy to help in any other way
(eg any questions about design/decisions)
- the main branch is Hack-only; the PHP-5 compatible stuff is here: https://github.com/facebook/xhp-lib/tree/1.x
<https://github.com/facebook/xhp-lib/tree/1.x>
- https://github.com/facebookarchive/xhp-php5-extension
<https://github.com/facebookarchive/xhp-php5-extension>
- the performance of XHP under HHVM is usually not a practical issue; it seems likely to be less of
an issue under PHP7. A good way to test could be to desugar some tests to plain PHP
(https://github.com/facebookarchive/xhp-php5-extension/blob/master/xhp/xhpize.cpp <https://github.com/facebookarchive/xhp-php5-extension/blob/master/xhp/xhpize.cpp>
), then run them under PHP5 and PHP7; this way you can measure without having to port the extension
first
- there are workarounds for when it is a real issue, eg https://github.com/hhvm/user-documentation/blob/master/src/site/xhp/APCCachedRenderable.php
<https://github.com/hhvm/user-documentation/blob/master/src/site/xhp/APCCachedRenderable.php>
- here, the performance was an insignificant part of real requests, but the navigation integration
tests were effectively a worst-case microbenchmark and test run time is important to us.
While facebook/xhp-lib must remain Hack because of the nature of it’s async support, I’d be
happy to work with a separate PHP7 library to avoid avoid any unnecessary differences - hopefully to
the point where we could have a shared ‘provides’ in composer. One option would be for the bulk
of the files to be transpiled (HHVM provides ‘h2tp’ for this), but have core classes like
:x:element written separately to strip out Async stuff.
Regards,
- Fred
> On Mar 20, 2016, at 11:21 PM, Daniel Beardsley <daniel@ifixit.com> wrote:
>
>> I agree XHP really is the right solution for this problem. It enables HTML
>> to be created structurally and composably with a concise inline syntax, just
>> like JSX/React does for JavaScript, and just like LINQ does for SQL in C#.
>> It's much better than passing around snippets of HTML as strings that can
>> easily break.
>
> Yeah, XHP is a great way to go, but it's so different from traditional
> templating and is a decent performance penalty that it's hard for pre-existing
> large projects to adopt.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>