W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2012

Re: [WebIDL] Would it make sense to add annotations for "creates a new object each time" and "always returns the same object"?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 23 Oct 2012 20:32:05 -0400
Message-ID: <50873705.2040803@mit.edu>
To: Jonas Sicking <jonas@sicking.cc>
CC: Ojan Vafai <ojan@chromium.org>, Glenn Adams <glenn@skynav.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 10/23/12 6:44 PM, Jonas Sicking wrote:
> However I agree that attribute getters in general should be returning
> the same object. So obj.attr === obj.attr should in general return
> true. Though I suspect that there are several cases where changing the
> object state will also change what object it returns.

Indeed.  For getters the useful annotation is when there is no way to 
change internal state in a way that affects the return value.

So .firstChild would not be able to be annotated in this way, while 
.style would be, for example.

Received on Wednesday, 24 October 2012 00:32:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:07 UTC