Mark S. Miller wrote:

        Only useful for instance-private instance variables, in which
        case you may as well use lexically captured per-instance state.


    No, "friend" is shared between two classes, no way to make a
    closure per instance extending over both constructors. Pretend the
    module above is an IIFE.


You're missing my point. My point is independent of whether there are two classes or one in the scope of your friend declaration. For simplicity let's say there's only class A. |this| binding only helps when a method is applied to its bound this, not to an argument. * It does not enable an instance of A to recognize that another instance of A is an A. * It does not avoid the storage cost of objects-as-closures, since you still need a function object per method per instance.

Sorry for being unclear -- my fault for not taking the time to develop the example. An example would have to avoid closure pattern even coming to mind, since I don't think it is relevant. The general problem is making a non-colliding name that can be used in two disjoint scopes, on objects of known provenance.

/be

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to