Will Squire
Will Squire

Reputation: 6595

How does Dart's operator overloading translate to javascript?

Very happy to see Dart support operator overloading (very cool :) ), but I am curious as to how this implementation translates to Javascript before I dive into developing something around this? Know this isn't something Javascript supports natively so wondered if there would be any complications around conversion to Javascript? As I believe not everything (such as the reflection/mirrors library) can translate.

In the case of an infix operator, I'm assuming it will just attached the function to the first variable and have the second variable passed as the function argument? I.e. instead of object + object, it will be object.plus(object)?

Thanks for reading :)

Upvotes: 1

Views: 125

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657741

Operators are just syntactic sugar for method calls and there is nothing special to consider for dart2js.

Upvotes: 3

Related Questions