Hi Harshad,
Thanks for looking into Sweet codes. See my comments below...
We can, but I don't find it any more elegant, (or more importantly
On Dec 28, 1:32 pm, Harshad <harshad...@gmail.com> wrote:
> Hi,
>
> I was just evaluating the Sweet framework.
>
> It looks interesting and the documentation is very helpful. Thanks!
>
> Some questions:
> 1. Is freemarker really required? Given that scala supports XML
> directly, couldn't we build a template system directly inside scala?
more efficiently) than using a template language like Freemarker.
There is nothing stopping us to to use JSP or just the Scala xml as
View layer. Based on my experience, I found the Freemarker is very
productive(like debugging/error message, reloading of the templates
etc), so I choose it as default. One can write a separate View class
implementation in Sweet and replace it to what u want.
Scala is needed to write the controller, and yes it would be nice to
> This would probably have two issues:
> a. People who write templates may now need to understand Scala a
> bit. (But then they don't need to learn another language like
> freemarker)
reuse in template too, but I firmly believe the separation of codes
from views, and Freemarker is not 100% to this, but can get very
close. One would simply need to create a Map of data and the framework
will expose it's names to template systems. Learning the syntax to
access this map is really not difficult... as I strongly encourage
view should just do that... loop and access the data and no fancy
logic. using Scala & XML as template will temp you to add logic view
at every corner. Maintaining it will be harder.
If Scala XML is your sweet spot as view, I encourage you take a look
at Lift(liftweb.net) project, they use that extensively.
Not sure what you mean here.
> b. Controller will need to be protected from the viewer using
> separate packages.
>
Hum... I am not aware of the speed gain when using the Symbol, but if
> 2. A lot of places where there are maps from String -> _ could be
> probably converted to Symbol -> _ to make things faster? For example,
> "main" -> MainController could become `main -> MainController
>
it is I will think about it. Using string will appear more easier to
understand and easier to the eye than that Symbol if speed is the only
reason. I generally found Scala is pretty fast compared to all other
JVM languages (other than the java itself of course), so it won't be
my main focus for the moment.