Improving Function.prototype.bind

Mark S. Miller erights at google.com
Fri Jan 6 08:58:59 PST 2012


On Fri, Jan 6, 2012 at 1:31 AM, David Bruant <bruant.d at gmail.com> wrote:
[...]

> David's WeakMap approach elegantly avoid this problem, because Alice and
>> Bob can only communicate if they already share access to this WeakMap, in
>> which case they could already communicate anyway.
>>
> Are you talking about https://gist.github.com/**1567494<https://gist.github.com/1567494>?
> Because I think I have the same issue. I think I faithfully implemented
> what Andrea described.
> Everyone with access to Object.prototype.boundTo has (implicitely) access
> to the WeakMap, so the capability leak you describe remains in my example,
> I think.


No, because that code would safely fail under SES, at the assignment

     Object.prototype.boundTo = function(fct){

since Object.prototype is frozen. I was referring to your approach. Note
that I did not need to offer a specific alternative implementation and API,
because any implementation and API that you design that actually provides
this service under SES will require the memo state used to be separately
instantiated for Alice and Bob. Thus Alice's memo cannot return something
that Bob's memo memoized.

-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120106/aa9213c7/attachment.html>


More information about the es-discuss mailing list