Skip to content

Introduce UInt1 type to replace misuse of Bool #18367

@TotalVerb

Description

@TotalVerb

This will solve a whole bunch of problems.

  • UInt1 is a lot more intuitive than Bool as a identity element for promote_type.
  • true + true === 2 won't be inconsistent with every other unsigned type; we can have UInt1(1) + UInt1(1) === UInt1(0) as expected.
  • Bool can be made non-numeric. (cc @StefanKarpinski)

I think the current system is really not ideal; it's worse than a method pun: it's punning a type for two very different things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mathsMathematical functionstypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions