On Wed, Apr 2, 2014 at 9:11 PM, Dmitry Lomov <dslo...@chromium.org> wrote:

>
>
>
> On Wed, Apr 2, 2014 at 8:26 PM, Mark S. Miller <erig...@google.com> wrote:
>
>>
>>
>> We could specify that WeakMaps can use typed objects as keys. The current
>> discussion in your article confuses semantics with implementation when it
>> speaks of typed objects comparing structurally. Typed objects have
>> identity, characterized by the four-tuple you explain. Just as all the bits
>> of a thin pointer are significant when comparing two thin pointers to see
>> if they point at the same semantic object identity, so are all the bits in
>> your fat pointer significant. Don't get confused by the bits in the pointer
>> to the fat pointer, when the fat pointer happens to be boxed.
>>
>
> It is unclear to me how WeakMaps can ever use typed objects as keys, since
> typed objects do not have their unique identity. Or rather, the only
> possible semantics I see is "hold to the value forever". So for example:
>
>    w = new WeakMap();
>    w[Point(buffer, 0)] = "abc"; // 1
>
>    w[Point(buffer,0)] = ? // 2
>
> I believe that in line 2, result should always be "abc" (since
> Point(buffer, 0) === Point(buffer, 0)).
> This is something we can spec, but it is probably not behavior we want.
>

(to put it another way, for "normal" objects/thin pointers, the user cannot
construct the new identical thin pointer out of thin air, therefore garbage
collection is possible; whereas the typed objects/fat pointers are
user-reconstructable at any point of time - so garbage collection is
impossible).

>
> Dmitry
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to