5 ms·
In solenya it's very terse - you can use the HTML to JS converter to see the translation is pretty straightforward: https://www.solenya.org/convert https://www.
by pickle-ts 6y ago
In solenya it's very terse - you can use the HTML to JS converter to see the translation is pretty straightforward:
https://www.solenya.org/convert https://www.solenya.org/convert
Example code:
div ({ class: "form-group" },
label ({ for: "exampleFormControlSelect1" }, "Example select"),
select ({ class: "form-control", id: "exampleFormControlSelect1" },
option ("1"),
option ("2"),
option ("3"),
option ("4"),
option ("5")
)
)
In conjunction with typestyle, you never have to leave js/ts. Very clean.
The arguments against this approach usually boil down to the mistaken notion that "you're not separating concerns". The response is: separation of language != separation of concerns. No matter what you should still strive to reduce cyclomatic complexity. So you're still separating model, view, themes etc. And you're doing so using abstractions within the language, rather than relying on language and file boundaries. Notably in the reverse case, when you have unavoidable links between these layers (since no useful abstraction isn't leaky), the benefits of expressing everything in one language are considerable (e.g. when refactoring).