operator overloading outside the type

Paul Backus snarwin at gmail.com
Wed Mar 26 21:22:18 UTC 2025


On Wednesday, 26 March 2025 at 16:59:47 UTC, Steven Schveighoffer 
wrote:
> I think we should enable this. It was identified pretty 
> recently in a stream of an influencer (see other messages in 
> this group), as something that is desirable.
>
> Especially with importC, where C does not support operator 
> overloading, it should just work. Indeed, in my [raylib 
> binding](https://github.com/schveiguy/raylib-d/blob/1cc76b8be3da3c1a34c54528678a62ce237c969e/source/raylib/raylib_types.d#L7), we purposely implement our own copies of all the basic POD types because we want to add operator overloads. This becomes MUCH simpler if we could just use UFCS operators.

I'm not opposed to this on principle, but I expect it will run 
into considerable pushback from Walter. Probably not a battle 
worth fighting.

> I also agree with the streamer that .h files should just work.

+1000. This is literally the number-one thing that ImportC needs 
to get right. The fact that it doesn't work is an embarrassment.


More information about the Digitalmars-d mailing list