19

Could this be true?

Comments
  • 6
  • 13
    This is evil!
    But the "maybe" is not the problem.
    Enums are typically only an abstraction to numbers, starting at zero. This makes "maybe" a 2, which is always true, so no problem.
    But "true" and "false"... they are switched! Here "true" is 0 and "false" is 1. That is going to make a lot of problems.
  • 3
    Obligatory TDWTF plug:

    https://thedailywtf.com/articles/..._

    enum Bool

    {

    True,

    False,

    FileNotFound

    };
  • 3
    Nein, Just nein.
  • 4
    Meanwhile in Rust:
  • 0
    @SomeNone the trailing underscore in that link is not retained for some reason
  • 1
    @Benedikt who says that 2 is true? Or even that 1 is true? Who says that booleans even have a numerical representation? 😉😇
  • 1
    @Geoxion @Benedikt but really, C not having booleans was a stupid idea.
  • 0
    @Geoxion Because everything is a number.
  • 2
    true is false
  • 1
    @Benedikt on the hardware, yes. But that doesn't mean the abstracted language type has to.
  • 2
    @Geoxion Name a language without numbers or math

    Edit: Non-esoteric
  • 1
    @010001111 in Rust, you can't convert a number to a bool directly. You need to do a comparison like 'let b: bool = num > 0;'.
  • 1
    @Geoxion Just yesterday I was telling my boss that I‘ll turn off no-implicit-type-coercion because at least in web frontend it’s 80% just „is it there?“

    Now I hate Rust, thanks.
  • 3
    @010001111 No don't! Compilers should have all the warnings and errors turned on, because they are actually almost every time right. It'll save you a lot of debugging.
  • 2
    Fuzzy logic
  • 1
    Aha! You've discovered Quantum Computing! ;-)
  • 3
    Ah, good old true, false & null.

    I wish I could murder null with a dull rusty hacksaw. Speaking of Rust... have you heard of our lord and savior ERROR[E0381]: BORROW OF POSSIBLY-UNINITIALIZED VARIABLE
  • 0
    True, false, null
Add Comment