I can answer how I understood, but I am not the proposer...

Andrea Giammarchi wrote:
   1. what's the expected behavior with mixins ( borrowed method from
      different classes ) ?

Each class has its own private scope, that is, private in borrowed method is in different "plane of existence" than private in actual class.

   2. what if Object.create(objectWithPrivates, descriptor) ? would
      descriptor methods be able to invoke objectWithPrivates.method()
      with private(this) access in the function body? If yes, would that
      private(this) refer to the objectWithPrivates? This would violate
      the objectWithPrivates private concept, isn't it?

Let the object created is foo. When calling foo.method(), it is accessing private(foo), not private(objectWithPrivates), since this is foo. "If yes" does not happen. Errors may happen since foo probably does not have private space (my proposal in this thread is touching this issue).

   3. are privates exportable? method() {return private(this)}

Not (if not throwing error, it should simply return this).

   4. are private properties, not private anymore once extracted,
      exportable? method(){return private(this).whatever}

This works as expected. This does not mean it is not private. It is readable via method, but not settable, so it still a private property, but with value published.

   5. what about a single block in the Class definition such private {c,
      i = 0, storage = {}, whatever} so that these are pre defined in a
      single place and callable across the class scope without requiring
      usage of private(this) but bound to the current context rather
      than shared across all instances?

I did not understand this question.

More may come up soon :-)

br

Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to