3 ms·
So we have JSX-like language support for: - Javascript / Typescript - Lua (this) - Go ( https://templ.guide https://templ.guide ) - Ruby ( https://github.co
by eterps 3y ago
So we have JSX-like language support for:
- Javascript / Typescript
- Lua (this)
- Go ( https://templ.guide https://templ.guide )
- Ruby ( https://github.com/camertron/rux https://github.com/camertron/rux )
Any others?
- aziis98 3y agoI just think more languages should support an idiomatic form of quasiquoting [1], then we may finally begin to stop seeing new JSX implementations everywhere. For Ruby it's strange somebody would prefer to write JSX instead of something like dhtml [2] or [3], are there any other advantages of writing xml directly in the code instead of a small html DSL? [1]: https://xelaso.net/blog/jsx-quasi-quoting/ https://xelaso.net/blog/jsx-quasi-quoting/ [2]: https://github.com/hi5dev/dhtml https://github.com/hi5dev/dhtml [3]: https://stackoverflow.com/questions/23469834/ruby-metaprogramming-with-method-missing-to-make-a-html-dsl https://stackoverflow.com/questions/23469834/ruby-metaprogra...
- bvisness 3y agoI’m not sure other languages can do “quasiquoting” very easily. Like, JS has template strings, but that’s not “quasiquoting” because the string content is unstructured. Lisp, though, can do this quite easily because it can still parse the unevaluated content with enough structure, and indeed can get you the same benefits I discuss in my article (like making wrapper component functions that directly access the list of children). As for preferring to write XML directly in my code…95% of my goal is to just deliver XML to the browser. I’d rather just write XML. And honestly the way text nodes are handled in other DSLs seems quite bad to me. I’d much rather write `long paragraph, <strong>emphasis,</strong> long paragraph` than HEREDOC-style long strings that I have to start and end every time I want some inline formatting. All the examples I see of HTML DSLs are heavy on structure but conspicuously lacking text. For me the text is _the whole point_. I don’t want to worry about string escaping when writing a blog post.