> If you don't want Object.prototype (why ?)
>
> do you want an enumerable, configurable, writable constructor ?
I don’t care much either way. The main point for me is that symbol instances
are immutable. If all of the instance’s prototype are also immutable, the
instance itself is "more immutable". Again, I don’t have strong feelings for
that.
> Why not just this ?
>
> exports.Symbol.prototype = Object.create(null, {constructor: {value:
> exports.Symbol}});
I don’t see much difference with my solution, either regarding conciseness or
regarding performance.
> Also why so many runtime closures and "var that = this" ?
Runtime closures:
- Does performance really matter here? I find my solution easier to read.
- Note that binding "this" via forEach() and map() also has performance
implications.
that = this:
- Your point is that forEach() and map() have a second parameter that allows
you to hand in a value for "this", right?
=> I have yet to find a clear argument in favor or against using that = this
here. Both solutions have performance implications, both solutions add an extra
line. that = this has two extra tokens, but adding a second argument looks
awkward.
> I would also drop all these anonymous functions using the closure with
> declarations for Symbol and Enum and export once at the end rather than
> reference the exports object each time.
Yes, good idea, it’ll make things easier to read.
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss