[Laszlo-dev] For Review: Change 20081021-ptw-2 Summary: Fix redefinition warning for implicit replication in swf9

André Bargull andre.bargull at udo.edu
Fri Oct 24 10:37:40 PDT 2008



On 10/23/2008 2:38 PM, P T Withington wrote:
> On 2008-10-23, at 04:47EDT, André Bargull wrote:
> 
>> There two issues:
>> 1) In the name setter, you update the node's name even if the name was 
>> invalid (e.g. a number).
> 
> I think that is the correct behavior.  The setter used to only update 
> the name if the name was a non-empty string, yet the API claims you can 
> set the name to 'null' to cause it to not have a name.  By extension, I 
> think the setter should always set the name to whatever value you pass, 
> but only bind in the global/parent/immediateparent if the name is a 
> string (and otherwise unbind).  I agree that it is not useful to set the 
> name of your view to something other than a string (or null), hence the 
> warning in debug mode (which should never happen in a type-checked 
> runtime).
> 
> Actually, I updated the change to enforce the name attribute being a 
> (nullable) string.  How about that?

Ok! :-)

> 
>> 2) The following testcase printed "nowID" prior to your change, now 
>> it's just `null`.
> 
> I think that was also a bug (which I may have created).  Having `name` 
> clobber `id` is non-deterministic because you don't know the order 
> initial values will be installed and there was no check for there 
> already being an id.

Both, name and id, are/were early-setters, which are ordered [1] and it 
was checked by calling "hasOwnProperty" [2].
(IMHO, it shouldn't set id and named canvas-subnodes shouldn't be global 
at all. But it's all about the "hysterical reasons" and to maintain 
bwcomp. We really ought to change this API..)



[1] I'm using those for reference
http://svn.openlaszlo.org/openlaszlo/tags/3.3.1/WEB-INF/lps/lfc/core/LzNode.as
http://svn.openlaszlo.org/openlaszlo/tags/4.0.0/WEB-INF/lps/lfc/core/LzNode.lzs

[2] For LPS4.0+:
"hasOwnProperty" originally didn't work as indented, because the 
id-setter was called after the name-setter, but since you've added the 
id-binder function, "hasOwnProperty" works properly! (The whole thing 
actually just worked in the past, because the id-setter overwrote the 
clobbered id, so the bad effect was neutralized.)

> 
> I think this difference should stand.
> 
>> <canvas debug="true" >     <view name="nowID" 
>> oninit="Debug.write(this.id)" />
>>   <view name="notID" id="theID" oninit="Debug.write(this.id)" />
>> </canvas>
>>
>> Otherwise approved.
>>
>>
>> On 10/22/2008 6:33 PM, P T Withington wrote:
>>> Change 20081021-ptw-2 by ptw at dueling-banjos.local on 2008-10-21 
>>> 13:30:10 EDT
>>>    in /Users/ptw/OpenLaszlo/trunk
>>>    for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>> Summary: Fix redefinition warning for implicit replication in swf9
>>>
>>> Bugs Fixed:
>>> LPP-7161 SWF9: redefine warning for replication
>>>
>>> Technical Reviewer: a.bargull at intensis.de (pending)
>>> QA Reviewer: promanik (pending)
>>>
>>> Details:
>>>    LzNode: make dynamically setting the name of a node consistent:
>>>    If the node was a named canvas child and you change the name,
>>>    remove the global binding (that's all you can do, we can't
>>>    dynamically create new global bindings).  Then move the node from
>>>    the old (if any) to new name in the parent and immediate parent,
>>>    warning if you clobber an existing name.
>>>
>>>    dummyclasses, LzRuntime: move the swf9 definition of `global` from
>>>    dummy to runtime.
>>>
>>>    NodeModel: track global names and ids in `global` for the swf9
>>>    implementation of `globalValue`.
>>>
>>> Tests:
>>>    Test case from bug, smokecheck
>>>
>>> Files:
>>> M      WEB-INF/lps/lfc/core/LzNode.lzs
>>> M      WEB-INF/lps/lfc/core/dummyclasses.js
>>> M      WEB-INF/lps/lfc/compiler/LzRuntime.lzs
>>> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
>>>
>>> Changeset: 
>>> http://svn.openlaszlo.org/openlaszlo/patches/20081021-ptw-2.tar
>>>
> 
> 



More information about the Laszlo-dev mailing list