https://github.com/sirisian/ecmascript-types/blob/master/README.md#classes-and-operator-overloading
https://github.com/sirisian/ecmascript-types/blob/master/primitivemetadata.md
tc39/proposal-operator-overloading#29
The primitive metadata extension defines syntax for primitive operator blocks.
In the now withdrawn operator overloading proposal I made an issue with the syntax:
// Extension operators for Vector2
class Number {
operator*(v:Vector2) {
return v * s;
}
}
// Extension operators for Matrix4x4
class Number {
operator*(v:Matrix4x4) {
return v * s;
}
}
with the primitive metadata operators it now looks like:
primitive number {
operator*(v: Vector2) {
return v * this;
}
}
primitive number {
operator*(m: Matrix4x4) {
return m * this;
}
}
Might move this to another markdown file as I want to include more examples.
https://github.com/sirisian/ecmascript-types/blob/master/README.md#classes-and-operator-overloading
https://github.com/sirisian/ecmascript-types/blob/master/primitivemetadata.md
tc39/proposal-operator-overloading#29
The primitive metadata extension defines syntax for primitive operator blocks.
In the now withdrawn operator overloading proposal I made an issue with the syntax:
with the primitive metadata operators it now looks like:
Might move this to another markdown file as I want to include more examples.