[Laszlo-dev] Constraint ordering and initial values [Was: For Review: Change 20090511-bargull-Yq7 Summary: constraint returns NaN in resizestatemin]

P T Withington ptw at pobox.com
Mon May 11 07:40:27 PDT 2009


I'm concerned that my r13731 change that sets the initial value of  
constrained attributes to `undefined` rather than `null` may have more  
fallout.  This change by André fixes one instance, but there could be  
many more lurking.

The issue:  Constraints run in random order.  Constraints that depend  
on attributes that are themselves constrained may reference those  
attributes when they are still undefined.  When used in a numeric  
expression, undefined coerces to NaN.  NaN's are "sticky", hence may  
pollute other attributes, and the constraint system may never recover.

r13731 was an attempt to make events fire less often by not having  
them fire when a constraint updated an attribute to the value it  
already had.  To do this I needed a sentinel value that indicated that  
the attribute had _never_ been updated (to distinguish the case where  
a constraint was setting the attribute to `null`).  `undefined` seemed  
to fit that bill, but clearly it has additional consequences, as seen  
in LPP-8088.

I'm looking for a way to achieve the optimization of 13731 without the  
NaN hazard.  I think this means that we have to revert to storing  
`null` as the initial value of constrained attributes (even better  
would be to store some type-correct equivalent of null).  And we'll  
have to have some sort of a flag that says you always send the event  
the first time around (e.g., when called from __LZapplyArgs).

On 2009-05-11, at 08:55EDT, P T Withington wrote:

> Approved as a work-around, but I think there may be a deeper issue  
> here...
>
> On 2009-05-10, at 18:58EDT, André Bargull wrote:
>
>> Change 20090511-bargull-Yq7 by bargull at dell--p4--2-53 on 2009-05-11  
>> 00:08:07
>> in /home/Admin/src/svn/openlaszlo/trunk
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: constraint returns NaN in resizestatemin
>>
>> New Features:
>>
>> Bugs Fixed: LPP-8088 (DHTML: many warnings from  
>> applyConstraintMethod())
>>
>> Technical Reviewer: ptw
>> QA Reviewer: (pending)
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details:
>> Default resize_min_width(height) to zero because if width/height  
>> gets set to NaN all sorts of bad side effects were triggered.
>> For example using lps/components/incubator/test/opttree/test.lzx:
>> If you click on the resizer, images are reloaded from the server  
>> and the scrollbar looks broken. This doesn't happen any longer  
>> after applying the patch.
>>
>>
>>
>> Tests:
>>
>> Files:
>> M lps/components/utils/states/resizestatemin.lzx
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090511-bargull-Yq7.tar
>>
>




More information about the Laszlo-dev mailing list