|
|
|
|
|
by ivankirigin
5974 days ago
|
|
XHP rocks so fucking hard, it isn't even funny. It is just so much better than alternatives. IMHO, It is the only PHP tool I use at facebook that is better than alternatives in other languages. I'm looking at you, django templates! The notation perfectly represents the objects, with no cruft associated with object oriented programming. That is really rare. You could argue that the markup syntax is cruft, but it really helps code readability to have two types of syntax, for code and for markup. $b = <span>quotes and variables</span>;
$a = <div>omg, I can't "believe" how easy these {$b} are</div>;
|
|
1. How is this different from Django filters? Is it that the default is HTML escaping instead of having to specify the escaping with each template variable?
2. How does it handle different escaping contexts? For example, text in html attributes needs to be escaped differently from text in the body of the document. Text in URLs or JavaScript has to be escaped differently still, and often times you have to combine these escapings (eg. a JavaScript onClick attribute). Is XHP smart enough to recognize these different contexts and do the right thing, or do you need to fall back to some manual mechanism?