[Laszlo-user] Laszlo Code Question

Adam Wolff adam at laszlosystems.com
Fri Apr 28 11:26:14 EDT 2006


I don't even think it's a syntax really. It looks the way it does for the 
same reason that your left eye is wired to your right brain (b/c god 
created it that way ;)

We had been discussing moving more of the instantiation logic into the 
runtime, but even in a JS runtime you need the to compiler to extract 
method bodies and also to decorate constraints with dependencies. (The 
latter is possible but impractical with regular expressions in the 
runtime.)

Jim and I have been talking about changing the way that replication works 
(see his RFC from a few months ago on declared replication.) Ideally we 
would move these classes into LZX, but to do see we would need to 
formalize aspects of the compiler pass. Ideally, we'd do something like 
what you suggest (though SWF compatible) but add a place where the 
compiler can pass additional attributes.

We may need to do this before legals.

A


On Apr 28, P T Withington wrote:

> Does anyone else think that this syntax is barfalicious?  Could we have a
> better way?
> 
> Is the arglist meant to be the JSON representation of the XML that you would
> have used statically?
> 
> With the advent of e4x, could we just use the XML?  Something like:
> 
> canvas.appendChild(canvas.createElement(
>  <{new_class} name="first" width="100" height="100" bgcolor="blue>
>    <view name="second" bgcolor="{red}" x="100" width="20" height="20 />
>  </{new_class}>));
> 
> ?
> 
> On 2006-04-28, at 00:33 EDT, Adam Wolff wrote:
> 
> > I didn't test, but I think this should be:
> > new new_class(canvas, {name: "first", width: 100,
> >                       height: 100, bgcolor: blue},
> >              [ { name : "LzView" ,
> >                  attrs: {name: "second", bgcolor: red, x: 100,
> >                          width: 20, height: 20} ], true );
> > 
> > 
> > A
> > 
> > 
> > On Apr 27, Max Carlson wrote:
> > 
> > > Hi,
> > > 
> > > I can't get this code example to work correctly to demonstrate how to
> > > instantiate a new class. The third argument is suppose to be for the
> > > children of this instantiated class, but how do you set the parent view
> > > of the children. Right now, the view "second" is appearing at the top
> > > level. This occurs naturally enough because I have supplied "null" as
> > > its parent argument, but canvas.first produces a "first property not
> > > found" error. The small red square should appear inside the blue square
> > > and be its child
> > > 
> > > <canvas>
> > >   <class name="new_class" width="100" height="100"/>
> > >   <handler name="oninit">
> > >      var parentview =
> > >          new new_class(canvas, {name: "first", width: 100,
> > >                       height: 100, bgcolor: blue},
> > > [ new LzView(null, {name: "second", bgcolor: red, x: 100, width: 20,
> > > height: 20})], true);
> > >   </handler>
> > >   <handler name="onaddsubview" args="view">
> > >      if (view.name <http://view.name> == null) return;
> > >      Debug.write("view = " + view.name <http://view.name>);
> > >   </handler>
> > > </canvas>
> > > 
> > > _______________________________________________
> > > Laszlo-user mailing list
> > > Laszlo-user at openlaszlo.org
> > > http://www.openlaszlo.org/mailman/listinfo/laszlo-user
> > > 
> > _______________________________________________
> > Laszlo-user mailing list
> > Laszlo-user at openlaszlo.org
> > http://www.openlaszlo.org/mailman/listinfo/laszlo-user
> 


More information about the Laszlo-user mailing list