Claus Reinke wrote:
1. I don't like the imperative approximations of a declarative API.
Since we're designing new language features, approximations
should not be necessary.

There have been suggestions to interpret '<|' declaratively,
and to avoid the special case for function rhs, ie, to interpret
(p <| obj) simply as a structural representation of an object with
un-nameable '[[prototype]]' field containing p.

You mean ditching function RHS completely or just not having it to
specially treat LHS being function as well?

Neither. Currently, <| sets the [[prototype]] field of the RHS object,
and -if the RHS is a function literal- also specifies the [[prototype]]
field of objects generated from it. I suggest to remove that special
case for function RHS.

I did not spell it well. This is what I meant with "specially treat LHS being function as well". I do not like the "also specifies ... from it" part, but you omitted a little details -- it only sets it when LHS has prototype property... nevertheless, it's an ugly special case.

On the other hand, I want this functionality built into language - because this is how "classical" class hierarchies are meant to be in JS. BUt I do not want it be a special case of <| - it should only set [[Prototype]] of newly created object, imo. I already proposed in other place that it can be for example:

function Sub (params) extends Super { body }

but distinct syntax element.

Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to