On May 15, 2011 8:59 AM, "Mark S. Miller" <[email protected]> wrote:
>
>
>
> On Sat, May 14, 2011 at 11:57 PM, Erik Corry <[email protected]> wrote:
>>
>>
>> On May 15, 2011 2:55 AM, "Boris Zbarsky" <[email protected]> wrote:
>> >
>> > On 5/14/11 6:37 PM, Oliver Hunt wrote:
>> >>
>> >> Can you provide a use case where you have an object key as the usual
programming idiom?
>> >
>> >
>> > Attaching metadata to object without polluting the objects themselves.
>>
>> That sounds more like private names
>
> Private name and soft field lookup inherits. WeakMap lookup doesn't.

In rhe case where you care about this you can use hasOwnProperty.

And I think you should be able to add private properties to frozen objects.
Since the properties are private they are invisible to whoever froze the
object so they can't violate the expectations of the freezer.  Perhaps it
also needs to be possible to freeze individual private properties (or their
absence) but being able to put a blanket ban on other parts of the program
performing an action that is undetectable to you feels wrong.

In terms of implementation this is no worse than keying a weak map with a
frozen object since that will also involve modifying the frozen object.

>
>
>>
>> >
>> > For example, Firefox extensions want to do this all the time for
various DOM objects (and especially Window).
>> >
>> > -Boris
>> >
>> > _______________________________________________
>> > es-discuss mailing list
>> > [email protected]
>> > https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
>
> --
>     Cheers,
>     --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to