Private Names and Methods

Axel Rauschmayer axel at rauschma.de
Thu Apr 5 09:37:53 PDT 2012


Agreed. But as far as I can see, such common code should always be able to take its private name with it.

For example:

let mixin = do {
    let privateName = name.create();
    ({
        [privateName](...) { ... },
        publicMethod(...) { ... this[privateName](...) ... },
    });
};

Even if defined outside, within a module, the private name should always be within reach.

On Apr 5, 2012, at 18:31 , Kevin Smith wrote:

> Aren’t you possibly overthinking the problem? Generic methods should normally only access public methods. Should you ever have different needs, you would need to come up with a more elaborate solution such as clients having to import both the generic method and the private name it uses.
> 
> But refactoring out common code within a class should be dead-simple and should not have any affect on the functionality of the public methods.
> 
> kevin

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

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


More information about the es-discuss mailing list