Rationale for not allowing overload of && and ||?

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Jun 18 14:50:00 PDT 2008


"BCS" <ao at pathlink.com> wrote in message 
news:55391cb32e4e58ca9f630a69297e at news.digitalmars.com...
> Reply to bearophile,
>
>> Joe Gauterin Wrote:
>>
>>> What is the rationale for not allowing overloading of && and ||? It
>>> seems to me that, with the 'lazy' keyword, D is one of the few
>>> languages where overloaded && and || can correctly implement short
>>> circuited evaluation.
>>>
>> I have created lazyAnd(), lazyOr() in my libs, and I think I like them
>> more explicitly named, to avoid confusion. They are shaped like:
>>
>
> || and && are lazy in D
>
>
> What does your provide that the native one don't?

It returns the value instead of the value converted to a bool. 





More information about the Digitalmars-d mailing list