[Feature Request] Keywords for symbol operators

Timon Gehr timon.gehr at gmx.ch
Mon Feb 26 09:02:37 UTC 2024


On 2/26/24 04:59, Steven Schveighoffer wrote:
> On Sunday, 25 February 2024 at 04:55:08 UTC, Danilo wrote:
>> What about adding [keyword 
>> forms](https://en.cppreference.com/w/cpp/language/operator_alternative) for some operator symbols, like in [C++](https://en.cppreference.com/w/cpp/language/operator_logical) ?
>>
>> ```
>> Symbol | Keyword
>> ----------------
>>   !    |   not
>>   !=   |  noteq
>>        |
>>   &&   |   and
>>   ||   |   or
>>        |
>>   &    | bitand
>>   |    | bitor
>> ```
> 
> Use ufcs:
> 
> ```d
> bool and(bool a, bool b) => a && b;
> 
>     if(foo.and(bar))
> // compare to
> // if(foo and bar)
> ```
> 
> -Steve

```d
bool and(bool a, lazy bool b) => a && b;
```


More information about the Digitalmars-d mailing list