Hacker News new | ask | show | jobs
by Tainnor 997 days ago
In order to make this not extraordinarily painful, you need some good language support for internal DSLs, or a template language / preprocessor, both of which Java doesn't really have. You could still do it somehow, but it probably wouldn't be the nicest experience. Plus, historically, the Java community has been in love with XML, so you'll find lots of templating libraries based on XML.

Swift has function builders which are part of the magic that makes such DSLs practical.

In Kotlin, which also runs on the JVM, this is possible much more easily than in Java: https://kotlinlang.org/docs/typesafe-html-dsl.html