Scoped binding of a method to an object

Rick Waldron waldron.rick at gmail.com
Sun Oct 13 13:26:21 PDT 2013


On Sun, Oct 13, 2013 at 12: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.
>

Not if I register the symbol in the not-yet-specified symbol registry.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131013/e3ffffa5/attachment.html>


More information about the es-discuss mailing list