version: multiple conditions

via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 18 02:57:19 PDT 2015


On Wednesday, 17 June 2015 at 17:24:50 UTC, ketmar wrote:
> On Tue, 16 Jun 2015 03:10:01 -0700, Walter Bright wrote:
>
>> I have yet to see a single case of "needing" boolean versions 
>> that could not be refactored into something much more readable 
>> and maintainable that did not use such.
>
> and i have yet to see such cases for multiplication operator. 
> it's cryptic, it's hard to read, it looks like line noise. 
> isn't this clear and readable?
>
>   a = 5.mul(12);
>
> and now see the stupid line noise, introduced by "*":
>
>   a = 5*12;

:)

Good use-cases for boolean overloads in addition to DSLs:

https://en.wikipedia.org/wiki/Fuzzy_logic
https://en.wikipedia.org/wiki/Three-valued_logic
https://en.wikipedia.org/wiki/Four-valued_logic

etc...

Although I think it might be more readable to have "and", "or" 
etc as operators. This is actually allowed in C++:

"a && b" <=> "a and b"…




More information about the Digitalmars-d mailing list