Ducks, Rabbits, and Privacy

Kevin Smith khs4473 at gmail.com
Tue Jan 22 19:28:00 PST 2013


A Duck/Rabbit Proposal:

1) There is only one kind of Symbol
2) Private data can be accessed via Object.getPrivate and Object.setPrivate

The goal is to provide a base-level API from which higher-level
abstractions can be built.

    // === Basic example ===
    var symbol = new Symbol(), obj = {};

    // Setting private data:
    Object.setPrivate(obj, symbol, {});

    // Getting private data:
    var data = Object.getPrivate(obj, symbol);

Note that this does not preclude the possibility of full private symbols in
ES7.

More at:

https://gist.github.com/4601469

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


More information about the es-discuss mailing list