The smoking gun...  I guess I had my chance to object!  Rats.

On 2008-10-02, at 20:02EDT, André Bargull wrote:


On 10/2/2008 10:22 PM, André Bargull wrote:
On 10/2/2008 8:57 PM, P T Withington wrote:
On 2008-10-02, at 10:55EDT, André Bargull wrote:


In the default event system, what you get if you don't write a custom setter, sends an event every time you call setAttribute. It does _not_ make any optimization to not send events if you happen to set an attribute to a value it already has.

A side note for the interested reader:
It's possible to turn on manually this optimization if you pass as the third argument to "setAttribute()" ?true?, e.g.
foo.setAttribute("text", "hello world!", true)
(That way the setter is not called when the value did not change.)

My head hurts trying to process that logic.  Too many negatives.

This seems like an incredibly dangerous optimization, because if you have a custom setter, how can the generic code know whether or not the value 'changed'? E.g., suppose the custom setter ensures your value is in a particular range or rounded to a particular granularity?

When did setAttribute grow this featureXXXXXXXbug? I don't recall seeing an API review for this.

It's there since 4.0.5

I'm searching for a specific changeset, but take a look what I found:
r6110 | max | 2007-08-17 05:11:57 -0700 (Fri, 17 Aug 2007) | 24 lines

Change 20070816-maxcarlson-f by [EMAIL PROTECTED] on 2007-08-16 20:44:10 PDT
     in /Users/maxcarlson/openlaszlo/wafflecone
     for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: UPDATED: Add flag to only setAttribute() if it the value passed in 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. W
ith inlining of setAttribute it will also make sense for performance.


 Tests: IWFM



Reply via email to