One of my favorite features in Scala is its a href="http://www.ibm.com/developerworks/library/x-scalaxml/"native support for XML/a(link warning, shameless plug.) I love the "projections DSL" (for lack of a better term) that is a href="http://www.scala-lang.org/docu/files/api/scala/xml$content.html"the scala.xml package/a. It is great for slicing up XML, and is almost like having native XPath and XQuery built into the language. Using XML in Scala for HTML generation is not as universally appealing to people. Some people think it encourages mixing presentation and business logic and is not "clean." I have even heard folks say that this is a critical flaw in Lift. I completely disagree. Of course I also think MVC is an anti-pattern, but anyways... HTML support in Scala is great in my opinion, but could be even better. Here is my wishlist.br /ulliBetter understanding HTML semantics. For example, it is great that the compiler won't let me do something like this lt;divHello worldlt;/di. However, I would not want it to even let me do lt;diHello worldlt;/di. Similarly I should not be able to stick a thead outside of a table. If I have an anchor tag with an href attribute, then I'd like the compiler to do some validation on the value. Am I asking for too much? Well, that's I'm supposed to do, right? Is some/all of this possible with the help of XML schema support? Maybe so./liliCSS. HTML without CSS ceased to exist a long time ago. With all of the DSL possibilities in Scala, is there some way to allow CSS literals and create some type safety for me. For example, I if I fat finger the name of a style on a class attribute, the compiler should catch this. Also I can say from experience that introducing an object-oriented model is really useful in CSS. Finally, the XPath/XQuery-like support in Scala XML makes me think that something similar could be done for CSS selectors./liliJavaScript. Honestly I don't know what I would want here. I like JavaScript, but I know the idea of being able to write your web application in a single language is very appealing to a lot of people. If nothing else, it would once again be nice if the compiler would prevent me from doing something like lt;button onclick="foo()" ... if there as no function called "foo" in scope./liliTooling. Most modern IDEs support things like syntax highlighting, code completion, error checking, code formatting for HTML and XML+schema. I expect at least this much for XML/HTML literals in Scala. I'd also like to be able to step through and debug literals. Refactoring on subtrees of XML (extract method for example) would be sweet. Oh, and large XML literals should not overwhelm my IDE :-)/li/uldiv class="blogger-post-footer"img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5819005-8640913259224946547?l=fupeg.blogspot.com'//div
Tuesday, July 28, 2009
My HTML in Scala Wishlist
One of my favorite features in Scala is its a href="http://www.ibm.com/developerworks/library/x-scalaxml/"native support for XML/a(link warning, shameless plug.) I love the "projections DSL" (for lack of a better term) that is a href="http://www.scala-lang.org/docu/files/api/scala/xml$content.html"the scala.xml package/a. It is great for slicing up XML, and is almost like having native XPath and XQuery built into the language. Using XML in Scala for HTML generation is not as universally appealing to people. Some people think it encourages mixing presentation and business logic and is not "clean." I have even heard folks say that this is a critical flaw in Lift. I completely disagree. Of course I also think MVC is an anti-pattern, but anyways... HTML support in Scala is great in my opinion, but could be even better. Here is my wishlist.br /ulliBetter understanding HTML semantics. For example, it is great that the compiler won't let me do something like this lt;divHello worldlt;/di. However, I would not want it to even let me do lt;diHello worldlt;/di. Similarly I should not be able to stick a thead outside of a table. If I have an anchor tag with an href attribute, then I'd like the compiler to do some validation on the value. Am I asking for too much? Well, that's I'm supposed to do, right? Is some/all of this possible with the help of XML schema support? Maybe so./liliCSS. HTML without CSS ceased to exist a long time ago. With all of the DSL possibilities in Scala, is there some way to allow CSS literals and create some type safety for me. For example, I if I fat finger the name of a style on a class attribute, the compiler should catch this. Also I can say from experience that introducing an object-oriented model is really useful in CSS. Finally, the XPath/XQuery-like support in Scala XML makes me think that something similar could be done for CSS selectors./liliJavaScript. Honestly I don't know what I would want here. I like JavaScript, but I know the idea of being able to write your web application in a single language is very appealing to a lot of people. If nothing else, it would once again be nice if the compiler would prevent me from doing something like lt;button onclick="foo()" ... if there as no function called "foo" in scope./liliTooling. Most modern IDEs support things like syntax highlighting, code completion, error checking, code formatting for HTML and XML+schema. I expect at least this much for XML/HTML literals in Scala. I'd also like to be able to step through and debug literals. Refactoring on subtrees of XML (extract method for example) would be sweet. Oh, and large XML literals should not overwhelm my IDE :-)/li/uldiv class="blogger-post-footer"img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5819005-8640913259224946547?l=fupeg.blogspot.com'//div
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment