[Laszlo-dev] Simple idea on how to update dynamic instantiation of user classes

Donald Anderson dda at ddanderson.com
Mon Jun 30 18:32:36 PDT 2008


Hi Sebastian,

I'll let others answer about future plans.  As for this script, we are  
following
your #1, we know all the class names in the laszlo libraries, and we  
augment
that list by the classes declared in the input files.  Everything  
else, including
Object, Array, ... as well as flash.display.* will be untouched.

At the moment, this is an additional tool to aid in conversion.

- Don

On Jun 30, 2008, at 6:42 PM, Sebastian Wagner wrote:

> hi,
>
> what will be the flow in the future?
> 1) checking for all available classname's and then replace only in  
> case of a match $something with lz.$something
> 2) or replace all new $something with lz.$something except  Object,  
> Array, String, Number, or Boolean
>
> There are many more cases then  Object, Array, String, Number, or  
> Boolean if you go into SWF Runtime, for exmple all the new Filters  
> of SWF8 look like:
> new flash.display.DropShadowFilter()
>
> This Script will be part of the OpenLaszlo Compiler or as an  
> additional Tool?
>
>
> sebastian
>
> 2008/7/1 Donald Anderson <dda at ddanderson.com>:
> Here's the perl script (attached).  I tried to upload it to the  
> Runtime_Differences page,
> but it looks like I can only update .gif/.jpeg files.  Any advice  
> about where to put it?
>
> I think I got all the cases:
>
> -   if the class name already has lz. , no change
>
> -   if the class name is a class defined in the input, then add lz.  
> (?)  [requires two passes]
>
> -   if the class name is class for a LFC tagname, convert it to  
> tagname and add lz.  (new LzView => lz.view)
>         I coded my list from WEB-INF/lps/server/src/org/openlaszlo/ 
> compiler/ClassModel.java
>
> -   if the class name is a known laszlo class, then add lz.
>         I have a fixed list embedded in the script, generated via  
> find WEB-INF/lps | xargs grep class
>
> -   new global[*] is converted to new lz[*]
>
> -   otherwise, no change (this includes Object, Array, ...).
>
> Let me know if there are any changes, should be easy to modify.
> Script includes a testcase to try all these situations.
>
> - Don
>
>
>
> On Jun 30, 2008, at 3:01 PM, P T Withington wrote:
>
>> One flaw in thus idea:  many times the argument to new will be a  
>> parameter of the class, so you have to skip all the class  
>> attributes too. That may make searching for only the defined class  
>> names a better choice of algorithm.
>>
>> On Jun 30, 2008, at 13:59, P T Withington <ptw at pobox.com> wrote:
>>
>>> The only 'native' classes that you might say `new *` or `x  
>>> instanceof *` about are:
>>>
>>> Object, Array, String, Number, or Boolean.
>>>
>>> So we should be able to add to the conversion script that if you  
>>> see `new *` or `x instanceof *` and * does not start with lz. and  
>>> is not one of the five native classes above, you should rewrite it  
>>> to lz.*.
>>>
>>> We also need to cover the case `new global[*]` needs to become  
>>> `new lz[*]`.
>>>
>>> Icing on the cake would be to replace instances of the LFC class  
>>> names with their tagname, e.g., (LzView becomes lz.view).
>>>
>
>
> --
>
> Don Anderson
> Java/C/C++, Berkeley DB, systems consultant
>
> voice: 617-547-7881
> email: dda at ddanderson.com
> www: http://www.ddanderson.com
>
>
>
>
>
>
>
> -- 
> Sebastian Wagner
> http://www.webbase-design.de
> http://openmeetings.googlecode.com
> http://www.laszlo-forum.de
> seba.wagner at gmail.com


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080630/36c2c3a1/attachment-0001.html


More information about the Laszlo-dev mailing list