Re:Universal Jinja: a crazy idea for a Python-ready front end
by paulddraper on Saturday July 15, 2017 @01:45PM
(#14777881)
Apples and oranges. (Or fruits and oranges?) JSX can only do XML; Jinja is for arbitrary text.
[ Parent
| on HN ]
Re:Universal Jinja: a crazy idea for a Python-ready front end
by andrewingram on Saturday July 15, 2017 @03:36PM
(#14778492)
Not quite true. Just because JSX resembles XML, it doesn't mean it can only output XML. Plenty of non-XML render targets exist for React: canvas, terminal, Sketch (I believe the file format is JSON).
The primary restriction is that your output can be modelled as a tree in some way, and what you find is that nearly everything falls into this category. I don't know if anyone's done it yet, but a plain-text renderer is certainly possible, I imagine it would be very similar to a terminal renderer.
Re:Universal Jinja: a crazy idea for a Python-ready front end
by paulddraper on Sunday July 16, 2017 @11:12AM
(#14782298)
If you're saying that JSX can do more than XML because you can transform from XML into other things, then yes, that's trivially true.
Re:Universal Jinja: a crazy idea for a Python-ready front end
by andrewingram on Monday July 17, 2017 @05:55AM
(#14786995)
No, I'm saying that JSX isn't XML, it just very loosely resembles it. It can't even naively output XML because it (currently) mandates a single root node, and XML has a doctype node as a sibling to that.
JSX transpiles down to a tree of function calls, it's literally nothing more than that, the only time it might be considered XML is in the final rendered content. Syntactically, JSX isn't even valid XML.