W3C home > Mailing lists > Public > public-web-perf@w3.org > March 2012

Re: performance.now, attribute or function?

From: James Robinson <jamesr@google.com>
Date: Wed, 7 Mar 2012 13:08:51 -0800
Message-ID: <CAD73mdJyvnOAnbi0aE-nBKuLZCdwBG3CSZ7=svXA3mN5sdzmYg@mail.gmail.com>
To: James Simonsen <simonjam@chromium.org>
Cc: public-web-perf@w3.org
I agree that a function makes more sense.

- James

On Wed, Mar 7, 2012 at 12:46 PM, James Simonsen <simonjam@chromium.org>wrote:

> I hadn't noticed that. The original proposal had it as a function. I
> prefer a function too.
>
> James
>
>
> On Wed, Mar 7, 2012 at 12:41 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>
>> Hi Perf minded people.
>>
>> I just noticed that window.performance.now is defined to be an
>> attribute. So the syntax is:
>>
>> x = window.performance.now;
>>
>> This feels a bit strange to me since generally it feels like
>> attributes represent a more constant value. I.e. that they only change
>> in response to explicit actions like function calls.
>>
>> In particular. I would have expected
>>
>> foo.bar == foo.bar;
>>
>> to always test true, for basically any 'foo' object and 'bar' property
>> name. However that obviously isn't the case for performance.now.
>>
>> It seems a bit more intuitive that
>>
>> foo.bar() == foo.bar();
>>
>> might not test true (at least in a non-functional language like JS).
>>
>> Obviously this isn't inherently the case. A getter can take just the
>> same types of actions as a function. It just seems like bad
>> programming style to do so.
>>
>> How would people feel about changing it to window.performance.now()?
>>
>> / Jonas
>>
>>
>
Received on Wednesday, 7 March 2012 21:09:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:32 UTC