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

12345swordy alexanderheistermann at gmail.com
Tue Nov 13 02:12:30 UTC 2018


On Monday, 12 November 2018 at 21:38:27 UTC, Walter Bright wrote:
> On 11/12/2018 8:28 AM, 12345swordy wrote:
>> The issue that I see is unintended implicit conversation when 
>> passing values to functions that have both int and bool 
>> overloads.
>
> The exact same thing happens when there are both int and short 
> overloads.
>
> The underlying issue is is bool a one bit integer type, or 
> something special? D defines it as a one bit integer type, 
> fitting it into the other integer types using exactly the same 
> rules.
>
> If it is to be a special type with special rules, what about 
> the other integer types? D has a lot of basic types :-)

Ok, you don't want to introduce special rules for integers, and 
that understandable.
However there needs be a tool for the programmer to prevent 
unwanted implicit conversation when it comes to other users 
passing values to their public overload functions.(Unless there 
is already a zero cost abstraction that we are not aware of).

-Alex


More information about the Digitalmars-d-announce mailing list