Play 2.0 uses a custom scala based template engine that allows to use a subset of scala inside html code.
Why was this design decision made instead of using scalas build-in xml mode?
The play template engine has some disadvantages like
- only a subset of scala is supported, for example it seems not to be possible to define functions inside of functions
- no editor support in eclipse
On the other hand, I understand that the play scala template engine supports non-well-formed html which wouldn't be possible with scalas xml mode, but I guess it should always be possible to write the templates in a well formed way. I'm just a beginner in play and scala and would simply like to understand the context.
I think it has several answers :
It is a template. Templates are not supposed to hold complex logic. All logic manipulation has to be done in the controller/model.
Templates can have about any format you want : email, CSV, SQL and so on. Restricting a template to valid XML is really limiting the possibilities of the framework.
Everything is compilable. Even routes, assets, template inheritance, etc. In order for those mecanisms to work with the rest of the framework, some choice probably had to be made. But no one will be able to answer you better than the creators of the framework.