@@toStringTag spoofing for null and undefined
Mark S. Miller
erights at google.com
Tue Jan 20 15:22:06 PST 2015
[resending to all, in case Dave isn't subscribed to es-discuss]
On Tue, Jan 20, 2015 at 3:20 PM, David Ungar <ungar at mac.com> wrote:
> Funny you should send this to me now; I’ve been thinking it was time to
> look up and chat with those of you whom I know.
>
> But on topic, the question in my mind would be: “Why does your language
> support === in the first place?”
>
> In the Self/Smalltalk world, if A === B (it was called == in those
> languages), it meant that no base-level message you could send would have
> an observable difference
> between sending to A vs B.
> For instance the code (in JS syntax)
>
> setA.add(“foo”)
> setA.print()
>
> would be the same as
>
> setB.add(“foo”)
> setA.print // notice the setA
>
> iff it were true that setA === setB
>
> In order to support proxies, the language needs to allow for the
> overriding of ===, and Self did exactly that.
>
> But it depends on the context, of course.
>
> - David
>
>
>
> On Jan 20, 2015, at 3:01 PM, Mark S. Miller <erights at google.com> wrote:
>
> [+ungar, +tvcutsem]
>
>
> On Tue, Jan 20, 2015 at 2:36 PM, Brendan Eich <brendan at mozilla.org> wrote:
>
>> Mark S. Miller wrote:
>>
>>>
>>> IIRC David Ungar's question to Tom was "why not enable proxies to
>>> mega-program every base-level operation in the language?" I took
>>> this to mean nothing like a nominal type check could evade
>>> proxying, in David's vision. Is this plausible in your view?
>>>
>>>
>>> No it is not. It destroys the whole point of branding if passing a brand
>>> check guarantees nothing.
>>>
>>
>> The counter-argument I inferred from the Q&A (this was in 2011, IIRC you
>> were there too ;-)
>
>
>
> I was not there, but I talked to Tom soon afterward. CC'ing Dave and Tom,
> who's memory of their conversation may also be informative ;)
>
>
>
>> would answer in two parts:
>>
>> 1. Needless-nominal type tests should be replaced by structural-type
>> tests.
>>
>> 2. Any remaining brand or trademark test can use object identity or
>> equivalent unforgeable capability.
>>
>> (2) can't be meta-programmed to spoof identity. But it doesn't leave
>> anything like nominal types as found in many languages lying around as an
>> attractive nuisance (and how, in Java!).
>>
>
> What I think I remember hearing from Tom is that Dave's main point, and
> the main argument with Tom, was precisely allowing proxies to intercede on
> === checks, in which case you wouldn't even have that as a reliable
> indicator.
>
>
>
>>
>> Now plausible?
>
>
> No.
>
>
>>
>>
>> /be
>>
>
>
>
> --
> Cheers,
> --MarkM
>
>
>
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150120/f545534d/attachment.html>
More information about the es-discuss
mailing list