DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

12345swordy alexanderheistermann at gmail.com
Mon Nov 12 16:28:49 UTC 2018


On Monday, 12 November 2018 at 10:05:09 UTC, Jonathan M Davis 
wrote:
> On Monday, November 12, 2018 2:45:14 AM MST Mike Parker via 
> Digitalmars-d- announce wrote:
>> DIP 1015, "Deprecation and removal of implicit conversion from 
>> integer and character literals to bool, has been rejected, 
>> primarily on the grounds that it is factually incorrect in 
>> treating bool as a type distinct from other integral types.
>
> *sigh* Well, I guess that's the core issue right there. A lot 
> of us would strongly disagree with the idea that bool is an 
> integral type and consider code that treats it as such as 
> inviting bugs. We _want_ bool to be considered as being 
> completely distinct from integer types. The fact that you can 
> ever pass 0 or 1 to a function that accepts bool without a cast 
> is a problem in and of itself. But it doesn't really surprise 
> me that Walter doesn't agree on that point, since he's never 
> agreed on that point, though I was hoping that this DIP was 
> convincing enough, and its failure is certainly disappointing.
>
> - Jonathan M Davis

The issue that I see is unintended implicit conversation when 
passing values to functions that have both int and bool 
overloads. If we have a way of indicating that implicit 
conversions are not allowed, when passing values to functions 
then the issues that the DIP brought up is resolved.

- Alex



More information about the Digitalmars-d-announce mailing list