> Part of this has had me considering if freezing classes (and all
recursively referenced types) used in the type system is viable.
function foo(bar: Array.<Set>) {
//whatever
}
[Array, Set] = [Set, Array];
foo(new Array([Set()]));
You can't freeze all builtins for obvious reasons.
You totally omitted point that your type system can't use or describe this
function:
function issue(Ctor) {
assert(Reflect.isConstructor(Ctor)); // Type system don't provide way to
disguintish object with [[Construct]] and [[Call]] methods.
assert(Foo.isPrototypeOf(Ctor)); // Type system don't provide way to
ensure prototypal inheritance
const retClass = class extends Ctor { // Type system don't provide way
to describe types being returned from function
};
Object.assign(retClass.prototype, mixin); // Object.assign can be
overridden to do anything, so actual code execution is required to prove
it's valid
return retClass;
}
TypeScript favors OOP because it supports virtually all OOP idioms, but
doesn't support non-basic FPP idioms.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss