Scoped binding of a method to an object

Kevin Smith zenparsing at gmail.com
Sun Oct 13 09:45:21 PDT 2013


>
>
>> 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.

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


More information about the es-discuss mailing list