Re: Lazy binding

2009-09-03 Thread ngocdaothanh
is seamless to use > from Clojure. > > I would recommend it for any templating needs, not just HTML views, in > fact I have used it at a micro level in Java to do just the kind of > lazy binding you are talking about, passed a template as a String > argument to a method and let the

Re: Lazy binding

2009-09-03 Thread James Sofra
used it at a micro level in Java to do just the kind of lazy binding you are talking about, passed a template as a String argument to a method and let the method then provide the attributes to be bound to the template worked great. Cheers, James Sofra On Sep 3, 11:23 pm, Stuart Sierra wrote: &g

Re: Lazy binding

2009-09-03 Thread ngocdaothanh
Using a map of keywords is a good solution, but I think it is somewhat just boilerplate code to satisfy the compiler, not to satisfy developers (yes, human). In view we have to write (:my-var map) everywhere. Is there a better way, something like lazy variable binding or lazy function binding? To

Re: Lazy binding

2009-09-03 Thread tmountain
I believe the way this works in rails has to do with the order in which variables are resolved. In this case, @name is an instance variable that's already been assigned elsewhere (your controller). Rails loads the view after the controller class has been instantiated. For this to work, the view is

Re: Lazy binding

2009-09-03 Thread Stuart Sierra
Check out www.stringtemplate.org, a Java template library with a functional design. -SS On Sep 3, 8:42 am, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > t

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
Oops, accidentally sent the post before it was ready. Oh, well... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: Lazy binding

2009-09-03 Thread Jarkko Oranen
On Sep 3, 3:42 pm, ngocdaothanh wrote: > Hi, > > In Rails you can create a view like this: > > my_view.erb: > <%= "hello" + @name %> > > I'm new to Clojure. I want to create something like the above like > this: > > (defn my-view [] >   (str "hello" name)) > > The point is: > * name is not known

Lazy binding

2009-09-03 Thread ngocdaothanh
Hi, In Rails you can create a view like this: my_view.erb: <%= "hello" + @name %> I'm new to Clojure. I want to create something like the above like this: (defn my-view [] (str "hello" name)) The point is: * name is not known when my-view is defined * I don't want to pass name as a argument