nadinengland/privy — pull request #1 by nadinengland (2013-04-07 08:52:24+00:00)
Title: Support for prototypal inheritance

This works by altering the private member function (typically `_`) to use a chain of keys and functions.

The key is used to identify which privates you are interested in when traversing the private member chain, this is so [multiple Privy functions](https://github.com/nadinengland/privy/blob/inheritance/spec/privy.spec.js#L138) can work on the same object. For each level of the chain a function is given, acting like the old private member function, that returns the sealer key.

This doesn't effect the way end users interact with the API, the Privy functions still work seamlessly:

```JavaScript
var p_alpha = new Privy(),
p_beta = new Privy();

var object = {},
alpha_privates = p_alpha.initiate(object),
beta_privates = p_beta.initiate(object);

p_alpha(object) === alpha_privates;
p_beta(object) === beta_privates;
```

Under the hood Privy is doing the following for each `p(object)` call:

```JavaScript
p.sealer.open(object._(p.key)); // privates
```

When not using inheritance this adds a large amount of indirection and overhead, hence why its not in master yet. I'm going to leave this open until I've spoken to another member of the JavaScript community.