proposal: Object Members

Ranando King kingmph at
Wed Aug 15 15:56:55 UTC 2018

The POC has been completed. This is a completely viable POC in that it can
be used in its present form in production code. I cannot speak for its
performance yet as I have done no performance testing on it. Seeing as how
it uses Proxy extensively to control access to private declarations, it is
likely to be slow. So this POC may not be suitable for use in high
performance applications. The biggest pain point for this POC is the fact
that `Function.caller` and `arguments.callee` have been completely crippled
to the the point of being useless. While I understand that their presence
prevented optimizations, it would be far more useful to allow the existence
of something like `Function.callerFrame` object with a `containsFn(fn)`
method to allow exact method identification without call access, and a
`previousFrame()` method to allow walking the call stack... but that's an
issue for a different proposal.

On Sun, Aug 5, 2018 at 9:41 AM Ranando King <kingmph at> wrote:

> Just released the POC code for review. Using the `Privacy()` export, you
> can now wrap any class or object definition and add `private` and
> `protected` members. To add privileged members to a `class`, declare a
> function `static [Privacy.Data]() {}` and return an object containing your
> `public` data and `private`/`protected` members. To add privileged members
> to any object, declare the field name with array notation, including the
> privilege level in the name. The "internal" privilege level has been left
> out of this POC and will be released as a separate proposal if this
> proposal gains any traction.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list