On Mon, Mar 30, 2015 at 8:54 AM, Domenic Denicola <d...@domenic.me> wrote:
> From: Kevin Smith [mailto:zenpars...@gmail.com] > > > I'd imagine that you'd re-spec [[Call]] for class constructors to > basically do `this[Symbol.call](...args)` instead of just throw. It would > therefore only have an effect within class constructors. Is that still > weird? > > At least it's explicable, but it's still pretty weird I think. I mean, we > don't specify [[Construct]] by saying that it does `new > this.prototype.constructor(...args)` or similar. The asymmetry is jarring. > > And it's weird to have this symbol with such a generic name that doesn't > work for anything except class syntax. I'd expect symbols to be for > re-usable protocols... that's fuzzy intuition though, I admit, and might be > contradicted by existing examples. > I like the idea of a special syntactic form a lot. One of the nice things about `constructor` is that it's easy to explain "you [[Construct]] with the constructor". We can't use `call` similarly any more, but I totally agree something like it would be pretty nice. On the flip side, it's not *entirely* clear that allowing people to override [[Call]] on an existing function is a no-go. Changing the `typeof` via installing a symbol definitely seems like bad juju though.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss