My notes inline.

On Dec 12, 12:34 pm, Timothy Perrett <timo...@getintheloop.eu> wrote:
> Hey Marius,
>
> Within this DSL will you be using JsObj under the hood or lift-json?

I was thinking to use lift-json in this case ... but I'd also of
prefer having a lift-js project.

>
> I would be very reluctant about adding new things to lift that don't  
> unify our Js and JSON libs.

Depends what you mean by unify. lift-json is not the same with js
support, js should utilize lift-json to build json constructs being
part of the javascript generated but lift-json has nothing to to with
a potential lift-js project. Therefore I would keep lift-json and lift-
js separated and have lift-js utilize lift-json whenever possible.

>
> On this note, will this unification take place before 2.0?

Too soon to tell. I'm not sure yet if people like this proposal so we
first need acceptance and then talk schedules.

>
> Cheers, Tim
>
> Sent from my iPhone
>
> On 12 Dec 2009, at 10:07, Marius Danciu <marius.dan...@gmail.com> wrote:
>
> > All,
>
> > I just want to see if there is any interest in the approach  
> > discussed here. As you know Lift has some interesting support for  
> > building JavaScript constructs from Scala code usig JsExp, JsCmd etc  
> > classes. I used quite a lot this support and it's great but if your  
> > JS code that you want to send down to the browser (say as an Ajax or  
> > Comet partial update response) gets a bit more complicated then  
> > constructing the JS fragment leads IMO to some cumbersome Scala  
> > code. I found myselft in quite a few situation to use JsRaw to write  
> > the JavaScript fragment in order for the code reader to understand  
> > what JavaScript code will be generated. But of course with JsRaw we  
> > put everything into a String so I'm not a big fan of this approach.  
> > So I started to define a JavaScript like "DSL" that IMO is closer to  
> > JavaScript form. Attached is a source code smaple of how this looks  
> > like, so for instance we can have something like:
>
> > val js = JsFunc('myFunc, 'param1, 'param2) {
> >     JsIf('param1 __< 30) {
> >         Var('home) := Wrap(234 __- 3) __/ 2 `;`
> >         Var('someArray) := JsArray(1, 2, 3, 4, 5) `;`
> >         'myFunc(1, 2, "do it", 'home) `;`
> >         $("#myID") >> 'attr("value", "123") `;`
> >       } ~
> >       JsForEach(Var('i) in 'someArray) {
> >         'console >> 'log("Hi there " __+ 'i) `;`
> >       } ~
> >       JsAnonFunc('arg1, 'arg2) {
> >        'alert("Anonymous function " __+ 'arg1 __+ 'arg2)
> >       }(1, 2) `;`
> >     }
>
> >     println(js.toJs)
>
> > this yields the following JavaScript code:
>
> > function myFunc( param1, param2 ) {
> > if (param1 < 30) {
> > var home = ( 234 - 3 ) / 2;
> > var someArray = [ 1, 2, 3, 4, 5 ];
> > myFunc(1, 2, "do it", home);
> > $("#myID").attr("value", "123");
> > }
> > for (var i in someArray) {
> > console.log("Hi there " + i);
> > }
> > function ( arg1, arg2 ) {
> > alert("Anonymous function " + arg1 + arg2)
> > }(1, 2);
> > }
>
> > ... ok I just droped nonsense code in there for exemplification. A  
> > few words:
>
> > 1. JsIf, JsForEach describe JavaScript if and for(each) statements
> > 2. Functions like __<, __>, ... __+, __- are function that alows  
> > definition of boolean and/or algebraic expressions.
> > 3. Wrap just wraps an expression into ()
> > 4. Var defined a variable
> > 5 := defines an assignment
> > 6. JsFunc declares a JS function
> > 7. JsAnonFunc declares an anonymous function
> > 8. 'myFunc(1, 2, "do it", 'home)  is simply a javascript function  
> > invocation by providing 4 parameter.
> > 9. ~ is just a function that chains statements that don;t  
> > necessarily end in ;
>
> > Do you think that something like this would be usable in Lift?
>
> > Br's,
> > Marius
> > --
>
> > You received this message because you are subscribed to the Google  
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en
> > .
> > <App.scala>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to