GNOME Bugzilla – Bug 726205
patch: operator overloading for +, -, *, /
Last modified: 2014-03-13 06:44:48 UTC
Created attachment 271660 [details] [review] Patch enabling operator-overloading for +, -, *, / Hi, Attached is a patch and a testcase for an operator-overloading feature i implemented for vala. With this patch you can add attributes like '[Semantics(overloads = "+")]' to a method which enables certain binary operations for instances of the class containing the method. Using a class like """ class Foo { [Semantics(overloads="+")] public Foo add(Foo foo1) { ... } } """ a statement like "var foo3 = foo1 + foo2;" is equivalent to "var foo3 = foo1.add(foo2);" When you are interested in this feature i will implement this for other binary operators too.
Created attachment 271661 [details] Testcase
*** This bug has been marked as a duplicate of bug 518604 ***