Finding a "safety syntax" for classes

Herby Vojčík herby at mailbox.sk
Tue Mar 27 10:51:42 PDT 2012



Domenic Denicola wrote:
> On Mar 27, 2012, at 13:10, "David Herman"<dherman at mozilla.com>
> wrote:
>
>> I recognize the C.prototype.constructor idiom already exists, but
>> it's a weak idiom. I'm not crazy about the idea of strengthening a
>> problematic but currently unreliable and rarely used idiom.
>>
>> Dave
>
> Speaking as a dev, I would like this idiom to be stronger (i.e. be
> there by default in a classy world). One use case that immediately
> springs to mind is try { } catch (e) { switch(e.constructor) { } },
> which we've used a couple times in the absence of Mozilla-style
> exception guards.
>
> Your concern about possibly not wanting to expose the constructor
> makes a lot of sense, but perhaps we could leave
> .prototype.constructor configurable and let people in such a
> situation explicitly delete it.

+1 (I wonder why they did not proposed this, they used it for the 
methods as well)


More information about the es-discuss mailing list