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

NoMoreBugs NoMoreBugs at outlook.com
Tue Nov 13 07:13:01 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 :-)

You nailed it on the head.

The only sensible course of action, therefore, is to give 
programmers the option to disable implicit conversions, 
completely (or if doable, more precisely).

And while you're thinking about how to do that, can you also 
please think about how to give the programmer the option to 
enforce privacy on variable/method within a module.

Programmers just want to be able to write code that is more 
likely to be correct, than not, and have the compiler catch it 
when it's not.

You want to attract such programmers, or not?



More information about the Digitalmars-d-announce mailing list