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

Re: performance.now, attribute or function?

From: James Simonsen <simonjam@chromium.org>
Date: Wed, 7 Mar 2012 12:46:49 -0800
Message-ID: <CAPVJQikLWmPLezuSa6P7hoUcbewHP73zTBBbHH7vjChFGNNjOA@mail.gmail.com>
To: public-web-perf@w3.org
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 20:47:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 March 2012 20:47:18 GMT