4 ms·
The one thing I want is operator overloading, so I can write vector calculations in a natural way. But this would need differing behavior depending on types, wh
by captainmuon 4y ago
The one thing I want is operator overloading, so I can write vector calculations in a natural way. But this would need differing behavior depending on types, which is something the developers don't want to add in principle. They say it has to be added in JS first, but this is something that makes not much sense in JS but is possible when you have type information at compile time. (You don't want to add the penalty of dynamic dispatch to every addition, just rewrite v1+v2 to v1.__plus__(v2) when you know statically that v1 and v2 are Vectors.)
I thought about implementing it myself (maybe as a babel transformation) but I couldn't figure out a way to access the type information.