Ducks, Rabbits, and Privacy

Kevin Smith khs4473 at
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

More at:

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list