Herby Vojčík wrote:
It can be blessed by Reflect.makeClass(classObject, protoObject) or
similar API.
It can bring lots of new patterns and cowpaths into the language.
If people don't want plain object to be the class, but their existing
object x, they do
Reflect.makeClass(x, (class {...}).prototype);
This can be in some version of `static` syntax in the future. BUt it
allows richer outcomes:
Not mere:
class Foo {
...
static {
// must be some predefined kind of body
}
}
but instead:
claas Foo {
...
static Expr;
}
where Expr can be any object that would be [[Construct]]ified and bound
to Foo. So it _can_ be {...} object literal, but it can be anything
else, existing object that user want to class-ify, a function, ...
and they then can `new x`. They choose what they will use as x for new
operator; because now class is one object and constructor is another.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss