[Laszlo-dev] For Review: Change 20070815-maxcarlson-U Summary: Add flag only setAttribute() if it changed

Max Carlson max at openlaszlo.org
Wed Aug 15 12:40:44 PDT 2007


P T Withington wrote:
> Not approved:
> 
> Unless I am really confused, I don't think your test is correct.

The test looks correct to me.  The idea is, if 'ifchanged' is true and 
the value is the same as it was before, don't do anything.  The 
rationale is to save users from having to type

if (this.foo != bar) this.setAttribute('foo', bar);

and have the compiler inline this for them along with the rest of 
setAttribute().

> And, I am not convinced this is a good change, since it is highly likely 
> our event system depends on an event being sent _any_ time an attribute 
> is set, whether it is changed or not.

Agreed.  That's why the default behavior is to always send the events, 
_unless_ 'ifchanged' is true.  Therefore, the only way the default 
behavior can change is when it's explicitly asked for.

If you don't believe me, run 'ant lztest' and 
http://localhost:8080/wafflecone/test/smoke/smokecheck.lzx!

> On 2007-08-15, at 14:23 EDT, Max Carlson wrote:
> 
>> Change 20070815-maxcarlson-U by maxcarlson at plastik on 2007-08-15 
>> 11:16:52 PDT
>>     in /Users/maxcarlson/openlaszlo/wafflecone
>>     for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
>>
>> Summary: Add flag only setAttribute() if it changed
>>
>> New Features:
>>
>> Bugs Fixed:
>>
>> Technical Reviewer: ptw
>> QA Reviewer: promanik
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details: Add a flag that only sets the attribute if its value 
>> changed.  It's a common pattern to only set an attribute when it 
>> changed.  With inlining of setAttribute it will also make sense for 
>> performance.
>>
>>
>> Tests: IWFM
>>
>> Files:
>> M      WEB-INF/lps/lfc/core/LzNode.lzs
>>
>> Changeset: 
>> http://svn.openlaszlo.org/openlaszlo/patches/20070815-maxcarlson-U.tar
> 

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list