Allen Wirfs-Brock wrote:
To actually add a computed function as the value of a prototype object property within the class definition is pretty much the same thing as defining an arbitrary valued prototype data property. Defining non-method prototype properties is one of the features that we have previous been unable to reach consensus on and for that reason was intentionally excluded from the maximal-minimal proposal. As the proposal says:

  * "There is (intentionally) no direct declarative way to define
    either prototype data properties (other than methods) class
    properties, or instance property"
  * "Class properties and prototype data properties need be created
    outside the declaration."


Thanks, and I'm hip to this already and agree with the design. The consequence for Nadav's scenario is that the whole prototype must be computed, via extends as you note, or just manual desugaring.

It's the right trade-off, and not just to get appropriately minimal classes into ES6 -- the computed method case is often part of a generative framework anyway, so won't obviously fit into any general, declarative syntax.

At least, this is my gut reaction -- but it would be helpful to see a concrete example in the wild (not contrived) and look deeper.

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

Reply via email to