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

P T Withington ptw at pobox.com
Tue Jul 1 04:43:58 PDT 2008


Right.  I sent the same caveat to Don.  His final script will be  
driven off the defined classes.

Even so, the script will not be able to find all the cases that need  
updating because it is only going to do trivial analysis, looking for  
tag names as arguments to `new` and `instanceof` and replacing them  
with class names.

I am working on some better compile-time warnings.

You will always get a runtime warning in debug mode because you will  
be calling `new` or `instanceof` on undefined.

On 2008-06-30, at 14:55 EDT, André Bargull wrote:

> What happens if I you write:
>> var clazz:Class = lz.view;
>> new clazz();
>> new LzDataElement("entry", {}, null);
>
> In these cases, you must not rewrite it to
>> new lz.clazz();
>> new lz.LzDataElement("entry", {}, null);
>
>> 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).
>




More information about the Laszlo-dev mailing list