[Dlang-internal] How about `and` and `or` like in Python?

Andrea Fontana nospam at example.com
Thu Oct 3 12:59:55 UTC 2019


On Wednesday, 2 October 2019 at 20:16:12 UTC, Walter Bright wrote:
> On 10/1/2019 8:18 PM, Mike Parker wrote:
>> So a suggestion in the forums is not going to be the way to 
>> get this feature added. You'd need to write a DIP presenting a 
>> strong justification for the added complexity and the 
>> potential code breakage. And given the nature of the feature, 
>> I'd say you'd be fighting an uphill battle (meaning, I don't 
>> think there is a strong enough case to be made).
>
> As I mentioned, C++ has them:
>
> https://en.cppreference.com/w/cpp/language/operator_alternative
>
> https://www.reddit.com/r/cpp/comments/4h5lsb/why_arent_alternative_operators_more_common/
>
> Adopting failed ideas from other languages is a pretty tough 
> sell. One can always write a DIP, but I don't see a path for 
> adoption for such a feature.

For some reason that syntax confuses me:

cout << true and false;

This prints out 1 in c++, but I read it as "cout << (true and 
false)".

Instead cout << true && false sounds to me like (cout << true) && 
false.






More information about the Dlang-internal mailing list