Are there any plans/proposals to specify user defined callable objects?
It's possible to extend Function, but it requires to specify function code
as string and prevents usage of local variables.
Eg:
```
class Foo {
constructor() {
this.i=0;
}
[Symbol.call]() {
return class.instance.i++; // new meta property
}
}
const f = new Foo;
typeof f === 'function';
f instanceof Function === false; // most use cases would be Function
instances
f() === 0;
f() === 1;
f.call(null); // TypeError: undefined is not a function
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss