Generic memory allocation in D

Daniel N no at public.email
Mon Mar 4 19:48:47 UTC 2024


On Monday, 4 March 2024 at 14:16:17 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> On 04/03/2024 10:53 PM, Walter Bright wrote:
>> On 3/4/2024 12:06 AM, Dom DiSc wrote:
>>> But why does it now return true on failure and false on 
>>> success?
>>> Isn't this exacly the bad re-definition of boolean you 
>>> advised us not to use?
>> 
>> 
>> It means I don't have to use ! in:
>> 
>>      if (foo())
>>      {
>>          error();
>>          return;
>>      }
>
> As others have suggested, the truthiness here kinda matters and 
> very much goes against the grain of pretty much what everyone 
> does.
>
> It is going to cause readers a problem (and yourself!) in the 
> future.

Had you used another type, like int, then it would follow 
standard practise much better that 0 is okay, but for bool... 
sorry despite the rest of your patch being great, I don't love 
unintuitive bools.




More information about the Digitalmars-d mailing list