Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-03 Thread Mark S. Miller
On Tue, Oct 2, 2012 at 9:05 PM, Norbert Lindenberg ecmascr...@norbertlindenberg.com wrote: TC 39, I need decisions so that I can finish the Internationalization spec and send it to the Ecma GA: 1) Instances of Intl.Collator, Intl.NumberFormat, and Intl.DateTimeFormat currently have

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-03 Thread Mark S. Miller
On Tue, Oct 2, 2012 at 10:13 AM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote: On Oct 1, 2012, at 9:56 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: We can try to tell ES implementors that they must do certain things in order to be in conformance but that really

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-03 Thread Brendan Eich
Mark S. Miller wrote: Allen and I also discussed the plan I intend to try in SpiderMonkey: making Date.prototype, Number.prototype, etc. test as Object according to the O_p_toString_call tag test. We think this should not affect SES or any real code (as Oliver postulated). I

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread David Bruant
2012/10/2 Mark S. Miller erig...@google.com On Mon, Oct 1, 2012 at 9:02 PM, Brendan Eich bren...@mozilla.com wrote: Words on paper still carry force but they do not necessarily have prompt effects, or any effects. It depends on the people reading them and implementing, and trying to follow

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 9:56 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: We can try to tell ES implementors that they must do certain things in order to be in conformance but that really doesn't work for code written by users of the language. You're right, we'd be letting usercode, not

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 4:08 PM, Domenic Denicola wrote: On Oct 1, 2012, at 18:58, Brendan Eich bren...@mozilla.org wrote: I am warming up to the way CoffeeScript does things -- not the translation scheme, __extends, __super__ -- rather, the plain Object instance created as C.prototype that

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Kevin Reid
On Mon, Oct 1, 2012 at 9:56 PM, Brendan Eich bren...@mozilla.com wrote: But if we have a solid branding mechanism (like Domado's ideal in latest browsers? ;-) then that should be used universally and this becomes a don't-care. MarkM suggested I should expound on what Domado does. Domado

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 10:37 PM, Brendan Eich wrote: Brendan Eich wrote: But if we have a solid branding mechanism (like Domado's ideal in latest browsers? ;-) then that should be used universally and this becomes a don't-care. Just to be crystal clear: * in pre-ES6 browsers, no

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Oct 1, 2012, at 9:56 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: We can try to tell ES implementors that they must do certain things in order to be in conformance but that really doesn't work for code written by users of the language. You're right, we'd be

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Kevin Smith
private @FooBrand; class Foo { constructor() { /* establish the internal Fooness of the instance */ this.@FooBrand = true; } } Foo.isFoo = function (obj) {return !!obj.@FooBrand}; Using this strategy, will isFoo not fail, if the specified object came from a

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Mark S. Miller
Having isFoo succeed on an instance of Bar is correct. But there's another case that's more worrisome: Foo foo = new Foo(); Baz baz = Object.create(foo); By Allen's pattern, isFoo will also succeed on an instance of baz. OTOH, were the branding done with a WeakMap or the brandcheck done with an

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Herby Vojčík
Allen Wirfs-Brock wrote: I think we have all the language features need to do reliable branding by ES programmers where they need it. We just need to establish the patterns for doing that. Here is the one I propose: private @FooBrand; class Foo { constructor() { /* establish the

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 2, 2012, at 10:18 AM, Kevin Smith wrote: private @FooBrand; class Foo { constructor() { /* establish the internal Fooness of the instance */ this.@FooBrand = true; } } Foo.isFoo = function (obj) {return !!obj.@FooBrand}; Using this strategy, will isFoo

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 2, 2012, at 10:47 AM, Mark S. Miller wrote: Having isFoo succeed on an instance of Bar is correct. But there's another case that's more worrisome: Foo foo = new Foo(); Baz baz = Object.create(foo); By Allen's pattern, isFoo will also succeed on an instance of baz. OTOH, were

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 2, 2012, at 10:52 AM, Herby Vojčík wrote: Allen Wirfs-Brock wrote: If you really need to strongly tie instantiation with branding you probably have to use a factory function: module Fooishness { export function FooFactory ( ){return new Foo}; FooFactory.isFoo =

Test for [[Construct]] invocation (was: Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?))

2012-10-02 Thread Herby Vojčík
Allen Wirfs-Brock wrote: On Oct 2, 2012, at 10:52 AM, Herby Vojčík wrote: Allen Wirfs-Brock wrote: If you really need to strongly tie instantiation with branding you probably have to use a factory function: module Fooishness { export function FooFactory ( ){return new Foo};

Re: Test for [[Construct]] invocation (was: Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?))

2012-10-02 Thread Brendan Eich
Herby Vojčík wrote: It can be `arguments.isConstruct`, for example. (One-handed Luke Skywalker voice:) NOo /be ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Kevin Smith
On the other hand, if you have many instances that need to be branded I suspect that the distributed symbol based technique is going to have a better performance profile than the WeakMaps. Is this true? Are there performance caveats that come with current WeakMap implementations? Kevin

Re: Test for [[Construct]] invocation (was: Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?))

2012-10-02 Thread Herby Vojčík
Brendan Eich wrote: Herby Vojčík wrote: It can be `arguments.isConstruct`, for example. (One-handed Luke Skywalker voice:) NOo Or whatever else, I just happened to write first thing where it could reside. /be ___ es-discuss

Re: Test for [[Construct]] invocation (was: Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?))

2012-10-02 Thread Kevin Smith
(One-handed Luke Skywalker voice:) NOo : ) Another perfect response! Kevin ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Mark S. Miller
On Tue, Oct 2, 2012 at 11:01 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Oct 2, 2012, at 10:18 AM, Kevin Smith wrote: private @FooBrand; class Foo { constructor() { /* establish the internal Fooness of the instance */ this.@FooBrand = true; } } Foo.isFoo

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 2, 2012, at 2:46 PM, Mark S. Miller wrote: On Tue, Oct 2, 2012 at 11:01 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Oct 2, 2012, at 10:18 AM, Kevin Smith wrote: private @FooBrand; class Foo { constructor() { /* establish the internal Fooness of the

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Norbert Lindenberg
TC 39, I need decisions so that I can finish the Internationalization spec and send it to the Ecma GA: 1) Instances of Intl.Collator, Intl.NumberFormat, and Intl.DateTimeFormat currently have [[Class]] Object. Should this change to Collator, NumberFormat, and DateTimeFormat, respectively? 2)

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Brendan Eich
At this point I'd go with Object (IOW, _stet_), unless Allen has a thought. /be Norbert Lindenberg wrote: TC 39, I need decisions so that I can finish the Internationalization spec and send it to the Ecma GA: 1) Instances of Intl.Collator, Intl.NumberFormat, and Intl.DateTimeFormat

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-02 Thread Allen Wirfs-Brock
On Oct 2, 2012, at 9:46 PM, Brendan Eich wrote: At this point I'd go with Object (IOW, _stet_), unless Allen has a thought. I agree. Regarding 3, if it is easy spec-wide to make the prototype non-instances that would be preferable, but as long as the per instance state in the prototype is

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Andreas Rossberg
On 30 September 2012 02:17, Brendan Eich bren...@mozilla.org wrote: Failing to consult with implementors will just make editing churn. I don't remember much discussion on this change, if any -- we did talk about the general problem of prototype objects being firstborns of their class, and how

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Kevin Smith
I think Allen is absolutely right that the magic incest of current built-ins is not going to scale, is semantically questionable, and should best be abandoned. : ) magic incest. This is pretty much a perfect response. Kevin ___ es-discuss mailing

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Oliver Hunt
V8 says no to both. And I fail to see what benefit there is to separating the two. In fact, it seems hostile to programmers to do so. I think Allen is absolutely right that the magic incest of current built-ins is not going to scale, is semantically questionable, and should best be

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Erik Arvidsson
On Sun, Sep 30, 2012 at 1:14 AM, Brendan Eich bren...@mozilla.org wrote: V8 and SpiderMonkey agree. This avoids making two paths for built-in constructor.prototype creation, one that makes a degenerate firstborn of the class at hand, the other than makes an Object-instance prototype. V8

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Andreas Rossberg wrote: Er, from my reading that's clearly not what the Wiki says for WeakMap. And it also is not what V8 implements, for either WeakMap or Map. Sorry, I was relying on Rick's testimony that the answers were 1) yes, 2) no. V8 says no to both. And I fail to see what benefit

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Nah, cheap shot. Let's reason together, not join taboo words. The built-ins do what they do and it could be considered a botch to abandon, but then there's still a scar lying between old and new built-ins. And classes have to do one or both (we may want to self-host built-ins with classes).

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Oliver Hunt wrote: FooPrototype being an instance of Foo makes things more complicated for no obvious reason, and is only really used by conformance suites anyway :D That's true enough. The dubious backward compatibility claims are what they are, though, and try inducting a bit: class C

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: Line 5.c.v is dealing with the ES5 requirement that host objects not reuse the listed [[Class]] values for anything other than the specified built-ins. This version of toStrimg extends the spirit to that restriction to all user or implementation defined tag values. It

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Rick Waldron
On Mon, Oct 1, 2012 at 3:21 PM, Brendan Eich bren...@mozilla.com wrote: Andreas Rossberg wrote: Er, from my reading that's clearly not what the Wiki says for WeakMap. And it also is not what V8 implements, for either WeakMap or Map. Sorry, I was relying on Rick's testimony that the answers

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Erik Arvidsson
On Mon, Oct 1, 2012 at 3:30 PM, Brendan Eich bren...@mozilla.com wrote: Erik Arvidsson wrote: I'm with Allen, Andreas and others that the craziness needs to stop. Which craziness? That the prototype of the constructor needs to be a special case of the instances created by the constructor.

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Rick Waldron wrote: On Mon, Oct 1, 2012 at 3:21 PM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Andreas Rossberg wrote: Er, from my reading that's clearly not what the Wiki says for WeakMap. And it also is not what V8 implements, for either

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Erik Arvidsson wrote: On Mon, Oct 1, 2012 at 3:30 PM, Brendan Eichbren...@mozilla.com wrote: Erik Arvidsson wrote: I'm with Allen, Andreas and others that the craziness needs to stop. Which craziness? That the prototype of the constructor needs to be a special case of the instances created

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Rick Waldron
On Mon, Oct 1, 2012 at 4:04 PM, Brendan Eich bren...@mozilla.com wrote: Rick Waldron wrote: On Mon, Oct 1, 2012 at 3:21 PM, Brendan Eich bren...@mozilla.commailto: bren...@mozilla.com wrote: Andreas Rossberg wrote: Er, from my reading that's clearly not what the Wiki says for

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 12:21 PM, Brendan Eich wrote: ... The best reason for using Object is the one Mark raised: class (as sugar for constructor/prototype) uses Object. But if you've read the thread this far, my objective is not to enforce one implementation approach or the other. It's to

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 12:39 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: Line 5.c.v is dealing with the ES5 requirement that host objects not reuse the listed [[Class]] values for anything other than the specified built-ins. This version of toStrimg extends the spirit to that restriction

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Norbert Lindenberg
It might be useful to list all the observable features to which valid instance of might lead for a built-in BuiltIn.prototype, and check whether we want them for new built-ins: 1) Object.prototype.toString.call(BuiltIn.prototype) returns [object BuiltIn]. True for ES5 objects, currently not

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 2:44 PM, Norbert Lindenberg wrote: It might be useful to list all the observable features to which valid instance of might lead for a built-in BuiltIn.prototype, and check whether we want them for new built-ins: 1) Object.prototype.toString.call(BuiltIn.prototype)

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Oct 1, 2012, at 12:21 PM, Brendan Eich wrote: ... The best reason for using Object is the one Mark raised: class (as sugar for constructor/prototype) uses Object. But if you've read the thread this far, my objective is not to enforce one implementation approach or

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Oct 1, 2012, at 12:39 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: Line 5.c.v is dealing with the ES5 requirement that host objects not reuse the listed [[Class]] values for anything other than the specified built-ins. This version of toStrimg extends the

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Norbert Lindenberg wrote: It might be useful to list all the observable features to which valid instance of might lead for a built-in BuiltIn.prototype, and check whether we want them for new built-ins: 1) Object.prototype.toString.call(BuiltIn.prototype) returns [object BuiltIn]. True for

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: Any observable features I missed? The relationship between the constructor and the prototype. EG: Builtin.prototype.constructor === Builtin Right! I forgot this a minute ago after showing how CoffeeScript does it. D'oh. I am warming up to the way CoffeeScript

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Domenic Denicola
On Oct 1, 2012, at 18:58, Brendan Eich bren...@mozilla.org wrote: I am warming up to the way CoffeeScript does things -- not the translation scheme, __extends, __super__ -- rather, the plain Object instance created as C.prototype that has B.prototype as its [[Prototype]] but has shadowing

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Domenic Denicola wrote: On Oct 1, 2012, at 18:58, Brendan Eichbren...@mozilla.org wrote: I am warming up to the way CoffeeScript does things -- not the translation scheme, __extends, __super__ -- rather, the plain Object instance created as C.prototype that has B.prototype as its

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Brendan Eich wrote: Erik Arvidsson wrote: On Mon, Oct 1, 2012 at 3:30 PM, Brendan Eichbren...@mozilla.com wrote: Erik Arvidsson wrote: I'm with Allen, Andreas and others that the craziness needs to stop. Which craziness? That the prototype of the constructor needs to be a special case of

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Norbert Lindenberg
On Oct 1, 2012, at 15:53 , Brendan Eich wrote: 2) BuiltIn.prototype has state that lets BuiltIn methods successfully operate on the object, at least as long as they don't modify the state. True for ES5 objects, currently also true for ES Internationalization objects. This means

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Norbert Lindenberg wrote: On Oct 1, 2012, at 15:53 , Brendan Eich wrote: 2) BuiltIn.prototype has state that lets BuiltIn methods successfully operate on the object, at least as long as they don't modify the state. True for ES5 objects, currently also true for ES Internationalization

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 3:48 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: Let me try explaining this again, No need to rehash. Responding to my point about other legacy tag tests that are not twiddled with ~ and so are possibly invalidated would be helpful. *Why* are the core

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Oct 1, 2012, at 3:48 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: Let me try explaining this again, No need to rehash. Responding to my point about other legacy tag tests that are not twiddled with ~ and so are possibly invalidated would be helpful.

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Norbert Lindenberg
On Oct 1, 2012, at 16:41 , Brendan Eich wrote: Norbert Lindenberg wrote: On Oct 1, 2012, at 15:53 , Brendan Eich wrote: 2) BuiltIn.prototype has state that lets BuiltIn methods successfully operate on the object, at least as long as they don't modify the state. True for ES5 objects,

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Norbert Lindenberg wrote: 3) The state mentioned in 2) is modifiable. True for some ES5 objects (Array, Date, RegExp), Don't forget Object:-P. I'm thinking of state that goes beyond an empty object and makes a BuiltIn instance function as a BuiltIn instance. Object instances have

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Mark S. Miller
Hi. Not filtering, just too busy to do more than skim. On Mon, Oct 1, 2012 at 5:40 PM, Brendan Eich bren...@mozilla.org wrote: Norbert Lindenberg wrote: 3) The state mentioned in 2) is modifiable. True for some ES5 objects (Array, Date, RegExp), Don't forget Object:-P. I'm

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Mark S. Miller wrote: Regarding the integrity of original Object.prototype.toString.call as a branding mechanism, I agree we need a new more general branding mechanism. WeakMaps and Symbols both give us a place to hang this, but we need a concrete proposal. The proposal should work both with

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Mark S. Miller
On Mon, Oct 1, 2012 at 8:17 PM, Brendan Eich bren...@mozilla.com wrote: Mark S. Miller wrote: Regarding the integrity of original Object.prototype.toString.call as a branding mechanism, I agree we need a new more general branding mechanism. WeakMaps and Symbols both give us a place to hang

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Mark S. Miller wrote: On Mon, Oct 1, 2012 at 8:17 PM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Mark S. Miller wrote: Regarding the integrity of original Object.prototype.toString.call as a branding mechanism, I agree we need a new more

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Mark S. Miller
On Mon, Oct 1, 2012 at 9:02 PM, Brendan Eich bren...@mozilla.com wrote: Mark S. Miller wrote: [...] Relaxing this requirement would still technically be a breaking change from ES5 so we need to be cautious. But I bet we can get away with it if we do it by ES6. By ES7 it will probably be

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Allen Wirfs-Brock
On Oct 1, 2012, at 9:02 PM, Brendan Eich wrote: Mark S. Miller wrote: On Mon, Oct 1, 2012 at 8:17 PM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Mark S. Miller wrote: Regarding the integrity of original Object.prototype.toString.call as a

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Mark S. Miller wrote: On Mon, Oct 1, 2012 at 9:02 PM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Mark S. Miller wrote: [...] Relaxing this requirement would still technically be a breaking change from ES5 so we need to be cautious. But I bet

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Allen Wirfs-Brock wrote: We can try to tell ES implementors that they must do certain things in order to be in conformance but that really doesn't work for code written by users of the language. You're right, we'd be letting usercode, not just some (benign or malign, but if malign then game

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-10-01 Thread Brendan Eich
Brendan Eich wrote: But if we have a solid branding mechanism (like Domado's ideal in latest browsers? ;-) then that should be used universally and this becomes a don't-care. Just to be crystal clear: * in pre-ES6 browsers, no @@toStringTag in the language to hack around with. * in ES6+

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Brendan Eich
Norbert Lindenberg wrote: Last week TC 39 approved a standard defining three new built-in constructors whose instances and prototype objects all have [[Class]] Object. Also, the prototype objects are not constructed by their respective constructors, but initialized by them, e.g., as

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Brendan Eich
Mark S. Miller wrote: On Sat, Sep 29, 2012 at 10:21 PM, Mark S. Miller erig...@google.com mailto:erig...@google.com wrote: I agree that the only security issue is avoiding the communications channel. Security aside, given maximin class Foo what do you suggest

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Brendan Eich
I hadn't reviewed the 9-27 draft's 15.2.4.2 Object.prototype.toString () yet. It seems to suppress exceptions, which is bad (step 6(c)(ii)). The ...(iv) substitution of ??? for must be a placeholder but why not throw there (in the case where @@toStringTag's value is not of String type)? The

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Rick Waldron
On Sunday, September 30, 2012 at 12:04 AM, Brendan Eich wrote: Rick Waldron wrote: On Sat, Sep 29, 2012 at 6:19 PM, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: My intention, subject to feedback here and from TC39, is to follow

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Brendan Eich
Brendan Eich wrote: The main thing I missed there is the prefixing of ~ on any tag naming a core language built-in constructor. What's this for? Why not for DOM built-ins too? This step: v. If tag is any of Arguments, Array, Boolean, Date, Error, Function, JSON, Math, Number, Object,

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Brendan Eich
Rick Waldron wrote: Using the prototype object here: Object.prototype.toString.call(Uint8Array.prototype).slice(8,-1)) But it's really usecase dependent, sorry for the noise It's a who-cares for sure -- typed arrays are rolling, even in IE10 (could someone please test the above there).

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Allen Wirfs-Brock
On Sep 29, 2012, at 11:11 PM, Brendan Eich wrote: Mark S. Miller wrote: On Sat, Sep 29, 2012 at 10:21 PM, Mark S. Miller erig...@google.com mailto:erig...@google.com wrote: I agree that the only security issue is avoiding the communications channel. Security aside, given

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-30 Thread Allen Wirfs-Brock
On Sep 30, 2012, at 9:47 AM, Brendan Eich wrote: Brendan Eich wrote: The main thing I missed there is the prefixing of ~ on any tag naming a core language built-in constructor. What's this for? Why not for DOM built-ins too? This step: v. If tag is any of Arguments, Array, Boolean,

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Yusuke Suzuki
Thanks for your reply. Why did I do this? Because, we are defining a significant number new built-in classes and it is going to be increasingly hard to define meaningful instance state for all such prototypes. It is also arguably undesirable for most of these prototypes. Does any really

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Axel Rauschmayer
I think it is time to recognize that the built-in ES constructors have always presented a class-like structure where it really is unnecessary and even arguably undesirable for their associated prototype objects to also act as instance objects. It's time to abandon that precedent and

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Allen Wirfs-Brock
On Sep 29, 2012, at 4:20 PM, Yusuke Suzuki wrote: Thanks for your reply. Why did I do this? Because, we are defining a significant number new built-in classes and it is going to be increasingly hard to define meaningful instance state for all such prototypes. It is also arguably

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have asked a similar question about Map.prototype. Why isn't Map.prototype a Map instances? Is this a bug or an intentional design decision? Historically, the prototype objects associated with the 9 named built-in

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Allen Wirfs-Brock wrote: My intention, subject to feedback here and from TC39, is to follow the pattern I used for Map as much as possible. However, TypedArray object are all ready implemented by all major browsers to that may limit how we apply it to them. Implementations differ:

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Rick Waldron
On Sat, Sep 29, 2012 at 5:17 PM, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have asked a similar question about Map.prototype. Why isn't Map.prototype a Map instances? Is this a bug or an intentional design decision?

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Rick Waldron
On Sat, Sep 29, 2012 at 6:19 PM, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: My intention, subject to feedback here and from TC39, is to follow the pattern I used for Map as much as possible. However, TypedArray object are all ready implemented by all major browsers to

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Rick Waldron wrote: On Sat, Sep 29, 2012 at 6:19 PM, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: My intention, subject to feedback here and from TC39, is to follow the pattern I used for Map as much as possible.

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Mark S. Miller
On Sat, Sep 29, 2012 at 5:17 PM, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have asked a similar question about Map.prototype. Why isn't Map.prototype a Map instances? Is this a bug or an intentional design decision?

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Allen Wirfs-Brock
On Sep 29, 2012, at 5:17 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have asked a similar question about Map.prototype. Why isn't Map.prototype a Map instances? Is this a bug or an intentional design decision? Historically, the

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Allen Wirfs-Brock
On Sep 29, 2012, at 7:23 PM, Rick Waldron wrote: ... Subjectively, the examples here are exactly how I would expect (hope?) this to behave, as the existing behaviour: Array.prototype.push(1) 1 Array.prototype [ 1 ] ...Has always been seemed strange ;) I believe this is the

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Allen Wirfs-Brock
On Sep 29, 2012, at 7:26 PM, Rick Waldron wrote: On Sat, Sep 29, 2012 at 6:19 PM, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: My intention, subject to feedback here and from TC39, is to follow the pattern I used for Map as much as possible. However, TypedArray

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Mark S. Miller wrote: On Sat, Sep 29, 2012 at 5:17 PM, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have asked a similar question about Map.prototype. Why isn't

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Mark S. Miller
On Sat, Sep 29, 2012 at 10:14 PM, Brendan Eich bren...@mozilla.org wrote: Mark S. Miller wrote: On Sat, Sep 29, 2012 at 5:17 PM, Brendan Eich bren...@mozilla.orgmailto: bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: However, there is a bigger issue here. You could have

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Allen Wirfs-Brock wrote: As I covered in my reply to Brendan, I don't think these are sufficiently defined to really answer. But if you definition of an instance is that Object.prototype.toString.call(Map.prototype) returns Map then the latest spec. draft does 1: yes, 2: no That's precisely

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Brendan Eich
Mark S. Miller wrote: Security aside, given maximin class Foo what do you suggest Foo.prototype be? If classes are sugar for constructor functions, an Object instance, just as you'd get for function Foo(){} Foo.prototype There has always been an unsightly difference between

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Yusuke Suzuki
Mark S. Miller wrote: Security aside, given maximin class Foo what do you suggest Foo.prototype be? I suggest adding @@toStringTag:Foo property to Foo.prototype when `class Foo` is executed. ___ es-discuss mailing list

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Mark S. Miller
On Sat, Sep 29, 2012 at 10:21 PM, Mark S. Miller erig...@google.com wrote: I agree that the only security issue is avoiding the communications channel. Security aside, given maximin class Foo what do you suggest Foo.prototype be? That was too vague. Reformulating. Private

Re: Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is Object?)

2012-09-29 Thread Norbert Lindenberg
Last week TC 39 approved a standard defining three new built-in constructors whose instances and prototype objects all have [[Class]] Object. Also, the prototype objects are not constructed by their respective constructors, but initialized by them, e.g., as Intl.Collator.call({}). Are you