> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
It's difficult because a template engine need a lot of syntactic sugar
and expressiveness that it difficult to achieve using Java. But I hope
that groovy++ will allow to add more compile time checks. Another
possibility is to use Scala to create a statically typed DSL.
for developers, I think you might have to choose Play if you are a
beginner.
for app size, I think play is good for large apps.
if you are an experienced Groovy programmer, and you are working on a
small or middle size app you may choose Grails. But Play is as good as
Grails for this kind of scope, too.
I switched from Grails ==> Lift ==> Play!
Bendanpa
Dustin
[1] http://www.mgutz.com/2010/03/12/templa_is_code_infusion.html
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
On Mar 12, 9:44 am, Roch Delsalle <rdelsa...@gmail.com> wrote:
> One question mark is usually better if you are expecting an answer,
> I don't know if it's available yet.
>
> http://github.com/mgutz/templa
>
>
>
> On Fri, Mar 12, 2010 at 11:40 AM, 曹江华 <tujiao....@gmail.com> wrote:
> > where is the website for Templa
> > ???????????????
>
> > On Fri, Mar 12, 2010 at 5:52 PM, mgutz <mario.l.gutier...@gmail.com>wrote:
>
> >> I am doing something along these lines with Templa [1]. Scalate
> >> isn't DRY enough for me.
>
> >> [1]http://www.mgutz.com/2010/03/12/templa_is_code_infusion.html
>
> >> On Mar 11, 8:28 am, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> >> > Also I would like to push a statically typed template engine as well.
>
> >> > It's difficult because a template engine need a lot of syntactic sugar
> >> > and expressiveness that it difficult to achieve using Java. But I hope
> >> > that groovy++ will allow to add more compile time checks. Another
> >> > possibility is to use Scala to create a statically typed DSL.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "play-framework" group.
> >> To post to this group, send email to play-fr...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> play-framewor...@googlegroups.com<play-framework%2Bunsubscribe@go oglegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/play-framework?hl=en.
>
> > --
> >http://www.caojianghua.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "play-framework" group.
> > To post to this group, send email to play-fr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > play-framewor...@googlegroups.com<play-framework%2Bunsubscribe@go oglegroups.com>
Templa uses Scala's parser combinators. Customizing the 'grammar' or
creating
a new one is fairly easy (if you know Scala). Templa will make more
sense
once I describe how simple object oriented paradigms
replace partials and layouts. Templa works with both Java and Scala
syntax.
I will commit the source once I have a web app example. I currently
have testable specs for
the default processor, not much more.
On Mar 12, 11:15 am, mgutz <mario.l.gutier...@gmail.com> wrote:
> I wanted to use Scalate, but having to declare binding variables in
> the code, in the template and have to pass them as render arguments is
> not very DRY.
>
the controller part is the standard play stuff (ie either you use
render(//params) or renderArgs.put() ), and I believe you will need to
do something similar with Tempa as well.
The only difference between scalate and the standard groovy stuff is
that you need to tell the types of the variables at the template side
as well for a few reasons: to enable precompilation, to avoid casting
issues, to provide static typing. I guess you can say that it's not
entirely DRY but the current solution means that the the layers are
well separated.
That being said, my main interest is to provide the best end to end
scala experience for play and I dig your approach as well, so if you
make Tempa's code available, I am more than happy to contribute to
your project.
I strongly agree with you, I also consider that templates should use
the language features, and not reinvent the wheel. I like what you're
trying to do here.
BUT
Declaring your vars / vals in the view is DRY in my opinion, because
the declaration in the template and it's call don't do the same thing.
Its just the very same when you create a class/function with
parameters and instanciate/call it somewhere.
Plus, I don't think that "injecting" the template in the controller is
a good idea since it will be a mess to debug.
Julien
On Mar 13, 12:40 pm, julien Tournay <boudhe...@gmail.com> wrote:
> @mgutz
>
> I strongly agree with you, I also consider that templates should use
> the language features, and not reinvent the wheel. I like what you're
> trying to do here.
>
scalate is using scala in "ssp" mode: http://scalate.fusesource.org/documentation/ssp-reference.html
On Mar 13, 1:36 pm, Mario Gutierrez <mario.l.gutier...@gmail.com>
wrote:
> I see your point with arguments vs parameters. I like how Ruby makes
> all of this transparent and want the same in Play. For the most part, that's
> what the default template engine in Play does for Java. I want less
> code in the markup.
>
it sounds like your issue really is static typing in which case I
would recommend to use either the standard groovy engine or create a
DSL which is not picky about types.
> Debugging a template is the same as debugging before with any template.
> There
> isn't any AFAIK in Play. The same effort. The generated class is viewable.
>
> Also, code should not be injected into a controller. It should be in a view.
>
> ## Index view
> object Index extends ViewContext with HtmlHelpers {
> def render = {
> // inject
> }
>
> }
>
> object Posts extends Controller {
> def render = Index.render
>
> }
>
> Where `ViewContext` has the usual request, response.
>
>
BTW that was my point about parameter passing, you will need to do
this in this design as well. Also, unless you can somehow pregenerate
that extra Index object into a separate package (which can be tricky
to do if parameters are involved), it will be really cumbersome to do
this stuff per method. Please note, I am not saying your idea is a bad
idea, just that play integration can be tricky.
Concerning Templa.
I don't want to write code that's just "glue" between my template and
my controller.
Play! (and Rails, and Django and...) allow me (the devellopper) to
focus on my app features, not on boillerplate code that just here
because it's needed by the language / framework.