Re: performance.now, attribute or function?

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 UTC