Overloading an operators

# Patrik Šimunič (7 years ago)

I hit on this topic while experimenting with imaginary numbers and although this subject was once already declined as proposal to ECMAScript 4, I would like to open it again. In a recent years ECMAScript has grown, a lot of application logic has moved from server to client and because ECMAScript is and (at least in a near future) will be the only major language for handling application logic in the client, it is essential that ECMAScript has to grow into more complex and capable language as we need it to handle more complex tasks.

One concrete way is adding an operators overloading feature. Imaginary numbers might not be the best example, so lets try to imagine more likely example, eg. vectors. When writing a module to deal with a vector graphic, you need a way to implement an operations with vectors. In most scenarios, it would be much easier for developers to define their own implementation of operators specifically for their scope - module.

Programming is very tightly related to math, we need a bit more robust language for dealing with more math related problems - this involves vectors, imaginary numbers, matrices, intervals and may other mathematical concepts. Since ECMAScript is currently the only cross-platform, natively supported language to write applications on client (I purposely don’t mention server side ECMAScript, because on this field you can argue, that there are other possible ways to go - from C# and Java to Go), it eventually has to grow to capability of performing most task that are in common server-side/programming languages possible.

Overloading an operators is just one way to get closer to this goal.

I am looking forward to your opinions, ideas and notes on this matter.