Shortcomings of D-Style Fused Operator Overloading

monkyyy crazymonkyyy at gmail.com
Sun Jul 9 05:22:35 UTC 2023


On Friday, 7 July 2023 at 09:18:38 UTC, Ahmet Sait wrote:
> 

I dislike the current scheme because its not very meta 
programmable

like, id like to write Nullable!T opcmp in 3 lines of code

```d
opCmp(typeof(this) a){
   if(a.isnull != isnull){
     return isnull.opCmp(a.isnull);}
   return value.opCmp(a.value);
}
```
That is very very much NOT how it works; maybe it should act like 
opBinary and
`a < b` is rewritten as `a.opCmp!"<"(b)` with some list of 
prefered overloads


More information about the Digitalmars-d mailing list