bool <=> int. WTF. (DIP0015)

Daniel Kozak kozzi11 at gmail.com
Wed Sep 18 08:06:26 UTC 2019


On Wed, Sep 18, 2019 at 8:10 AM Rob T via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> Sorry old thread I know, but I just got hit by an implicit bool
> to long conversion bug today, it's been a recurring theme over
> the years, so I checked in to see if anything had finally been
> changed to address the recurring bool issue and found this thread
> which is relatively recent, and also DIP 1015 that was rejected.
>
> Perhaps the best solution, is rather than attempting to change
> what are deeply ingrained and polarised concepts surrounding the
> existing quasi bool/integral type, is a DIP proposing the
> addition of a new formally defined boolean type that would leave
> the existing bool type in place unchanged, no compromises have to
> be made, and no legacy code will have to be broken.
>
> Any thoughts on if there may be at least some possible open
> minded support by the two guys who have the veto power?
>

You can do this on your own, just make your own Boolean type, or it
could be added to Phobos, in theory it is there already:
https://dlang.org/phobos/std_typecons.html#.Flag.Flag


More information about the Digitalmars-d mailing list