On 10/16/15 2:00 PM, Martin Thomson wrote:
On Fri, Oct 16, 2015 at 9:30 AM, Boris Zbarsky <bzbar...@mit.edu> wrote:
I'm not sure what custom code you're talking about.  What exactly are you
proposing?

Date is fundamentally just an integer when you get down to it.  Treat
it like one.  An integer value is copied when you return it, so
modifications don't affect the underlying structure.

Integer values also do structural ==, not object identity ==. And can't be mutated (mutating actually just creates a new value)

You seem to be arguing that Date should really be a value type in ES. That's an argument I'm sympathetic to, but that's not the Date we have right now.

So if you want to have value type like behavior, use a value type; for now long long (in IDL terms; Number in JS terms) is good. If you want to have a possibly-shared reference to a mutable thing, then Date makes sense. Once ES grows actual value types, we can think about doing something like that for date return values in APIs.

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to