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

Donald Anderson dda at ddanderson.com
Tue Jul 1 05:32:27 PDT 2008


On Jul 1, 2008, at 7:01 AM, P T Withington wrote:

> On 2008-06-30, at 18:21 EDT, Donald Anderson wrote:
>
>> 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?
>
> The other conversion script is in WEB-INF/lps/server/bin (not that  
> that is the right place, but it is where lzc and other scripts are,  
> so should already be in the search path of most developers who will  
> need this script).

Alright.

>
>
>> I think I got all the cases:
>>
>> -   if the class name already has lz. , no change
>
> Correct.
>
>> -   if the class name is a class defined in the input, then add lz.  
>> (?)  [requires two passes]
>
> Correct.  All LZX classes defined with <class name="foo"... must be  
> referenced as lz.foo in `new` and `instanceof`.

I'm a little confused.  I thought this script only converted .lzs files.
It sounds like the script operates on and converts both, but we should  
only collect the class names
I see in LZX on the first pass.   ??

>
>
>> -   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
>
> Optional, but good practice.
>
>> -   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
>
> No.  Only LFC classes that implement LZX tags should be converted,  
> and that is covered by the previous step.

Okay.

>
>
> [Detail:  Script class definitions _do_ create global definitions.   
> Eventually we will want these in a laszlo namespace, but that will  
> be by `use namespace` or something.  Certain LFC script classes  
> implement tags and are entered into the `lz` namespace by hand in  
> the LFC.  E.g., if you look at the bottom of the file defining  
> LzView, you will see:
>
>  lz[LzView.tagname] = LzView;
>
> That little bit of glue attaches the LFC implementation to the LZX  
> interface.]
>
>> -   new global[*] is converted to new lz[*]
>
> Correct, unless the user code is doing something really tricky.   
> Perhaps the script should announce when it is making this transform,  
> as it should be manually verified.
>

Can do.

>> -   otherwise, no change (this includes Object, Array, ...).
>
> Correct.
>
>> Let me know if there are any changes, should be easy to modify.
>> Script includes a testcase to try all these situations.
>
> Once the above fixes are made, how about sending out a regular  
> review request.  Perhaps Sebastian would like to be one of the  
> reviewers.
>
Okay.

Thanks!

--

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/20080701/f2e0cf0a/attachment-0001.html


More information about the Laszlo-dev mailing list