On 8/14/2009 4:57 PM, P T Withington wrote:
> I wonder if it would be better to rename __LZlateInit to 
> __LZinstantiated (reversing the sense).  It would then be false 
> initially and would only be set true by __LZinstantiationDone.  
> createChildren would not have to change it.  __LZcallInit would only 
> recurse into subnodes that were not already inited and were finished 
> instantiating.  I think that would achieve the same end, but make the 
> name and logic a little simpler?

It's not exactly the same, it's even better! Consider this testcase:
---
<canvas debug="true">

   <node initstage="late">
     <node>
       <handler name="onconstruct">
         this.parent.completeInstantiation();
       </handler>
       <handler name="oninit">
         Debug.debug("oninit for %w (%w)", this, this['bar']);
       </handler>
       <node name="bar"/>
     </node>
   </node>

</canvas>
---

Without and even with my patch, the "oninit"-event is send twice, but 
with your proposed change, it's only send once! Great, thanks!


> 
> Otherwise approved.  Great work!
> 
> 
> On 2009-08-13, at 18:24EDT, André Bargull wrote:
> 
>> Change 20090812-bargull-C3Q by barg...@dell--p4--2-53 on 2009-08-12 
>> 23:52:25
>> in /home/Admin/src/svn/openlaszlo/trunk
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: improve "destroy when initializing" behaviour
>>
>> New Features:
>>
>> Bugs Fixed: LPP-8386 (constrained datapath leads to runtime errors for )
>>
>> Technical Reviewer: ptw
>> QA Reviewer: (pending)
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details:
>> Changes for LzNode:
>> 1) applying constraints may destroy a node (eg. by replication), 
>> handle this case in LzNode#__LZresolveReferences()
>> 2) instantiating subnodes may destroy a node, handle this case in 
>> LzNode#__LZcallInit()
>> 3) calling determinePlacement() may destroy a node (see ), handle this 
>> case in LzNode#construct()
>> 4) you cannot store "subnodes.length" before iterating over the 
>> subnodes in LzNode#__LZcallInit(), because the subnodes array may 
>> change (cf. 2nd testcase from bugreport)
>> 5) set LzNode#__LZlateinit to "true" in LzNode#createChildren() for 
>> all initstages, this prevents a corner case in which nodes are inited 
>> two times (4th testcase from bugreport). Set __LZlateinit back to 
>> "false" in LzNode#__LZinstantiationDone(), so nodes are processed 
>> properly again.
>> 6) remove some cruft:
>> - LzNode#getAttribute(), it is deprecated since 4.1
>> - the $refs-mechanism, it was scheduled to be removed in 4.1+
>> - setSetters() and addSetter(), also scheduled for 4.1+
>>
>> Changes for LzCanvas:
>> - all changes from LzNode#__LZcallInit() are copied over, without 2) 
>> because canvas can't be destroyed
>>
>>
>> Tests:
>> all testcases from bugreport (swf8, swf9)
>> smokecheck (swf8, swf9, dhtml)
>> component sampler (swf8, swf9, dhtml)
>>
>> Files:
>> M WEB-INF/lps/lfc/core/LzNode.lzs
>> M WEB-INF/lps/lfc/views/LaszloCanvas.lzs
>>
>> Changeset: 
>> http://svn.openlaszlo.org/openlaszlo/patches/20090812-bargull-C3Q.tar
>>
> 
> 
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to