Scoped binding of a method to an object

Till Schneidereit till at tillschneidereit.net
Sun Oct 13 09:51:44 PDT 2013


On Sun, Oct 13, 2013 at 6:45 PM, Kevin Smith <zenparsing at gmail.com> wrote:
>>>
>> This is trivial with Symbols:
>>
>>   let shuffle = Symbol();
>>
>>   Array.prototype[shuffle] = function() {...};
>>
>>
>> Only code that has access to the `shuffle` symbol may use the method:
>>
>>   let shuffled = array[shuffle]();
>>
>
> Unfortunately, such a construction will fail in a multi-realm (i.e. multiple
> frames) environment.

That's what the symbol registry will solve, though.


More information about the es-discuss mailing list