operator overloading outside the type

Derek Fawcus dfawcus+dlang at employees.org
Sat Mar 29 19:23:07 UTC 2025


On Saturday, 29 March 2025 at 19:06:18 UTC, Walter Bright wrote:
> On 3/29/2025 9:31 AM, Steven Schveighoffer wrote:
>> One reason why I rarely propose things in D these days is 
>> because the parade of C++ bogey-straw-men come out every time, 
>> which have nothing to do with the proposal.
>
> See my reply to Timon's response.
>
> There's got to be a high bar for adding new features, each one 
> adds more cognitive load to anyone trying to understand the 
> language.


I suppose one could always add Algol 68 like operator functions, 
such that one could then write something like:

```
int something(int a, int b) {

    return a plus b;
}
```

Assuming one could figure out a syntax for declaring 'plus', and 
then avoid it being backward incompatible...




More information about the Digitalmars-d mailing list