New private names proposal
Kam Kasravi
kamkasravi at yahoo.com
Tue Dec 21 23:54:56 PST 2010
Caja is a good example of looking at the ramifications of freezing objects
especially related to the DOM.
MarkM (and others) could comment on its impacts. For YUI 2.8 - there were some
problems when
Yahoo cajoled the library, but I believe less than expected. We had some app
breakage for 3rd party
apps that were cajoled for open social as well.
Would extending the descriptor in Object.defineProperty(obj, prop, descriptor)
to provide
a meta-value for private field be less confusing to the user?
- where the descriptor could be extended in have a field of visible or private?
{value: 'foo', private: true}
though it doesn't make much sense to have
{value:'foo',private:true,enumerable:true,writable:true}
in which case an exception could be thrown about incompatible descriptor
values...
________________________________
From: Brendan Eich <brendan at mozilla.com>
To: Alex Russell <alex at dojotoolkit.org>
Cc: es-discuss at mozilla.org
Sent: Tue, December 21, 2010 10:40:59 PM
Subject: Re: New private names proposal
On Dec 21, 2010, at 10:17 PM, Alex Russell wrote:
> On Dec 21, 2010, at 10:14 PM, Brendan Eich wrote:
>
> I fear APIs that freeze, only take frozen objects or only have versions that
>do, or are so mutability-hostile that they warp our use of the language toward
>frozen-by-default constructs. Those are the sorts of things that spread it.
Spread it how, pray tell?
Putting Object.create/freeze/etc. in ES5 (let's leave aside the API design
errors that people debate) does not create a wolf in the fold, or a runaway
water crystallization threat. No coercive entity forces developers to use any of
the freezy bits here.
You think TC39 will make APIs that only work with frozen objects? Or HTML5 or
Web Apps in the w3c? There's no evidence for this fear, no obvious way these
APIs could be deployed in a mixed-browser version market, and plenty of evidence
that developers -- both web and browser -- would reject such attempts. I know a
bunch of us at Mozilla would.
I think we've gone way off the technical beam here. There are valid uses for
immutability, in building systems that have safety and parallelization
properties. That's a fact. We're not going to reject freeze from JS just out of
fear that someone might become Dr. Freeze. If that happens, call Batman. Better:
be Batman.
/be
_______________________________________________
es-discuss mailing list
es-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101221/03cf6ca6/attachment.html>
More information about the es-discuss
mailing list