March 09, 2017 can I overload operators as extension methods? | ||||
---|---|---|---|---|
| ||||
The same way as T.foo() is lowered to foo(T) if no such member is defined inside the type. It would allow me to extend 3rd party types with operator notation without wrapping them. After trying and reading the specification, looks like nuts, but just wanted to confirm. Thx |
March 09, 2017 Re: can I overload operators as extension methods? | ||||
---|---|---|---|---|
| ||||
Posted in reply to XavierAP | On Thursday, 9 March 2017 at 23:50:04 UTC, XavierAP wrote:
> The same way as T.foo() is lowered to foo(T) if no such member is defined inside the type.
No.
But wrapping in a struct with alias this lets you extend them pretty easily too.
|
Copyright © 1999-2021 by the D Language Foundation