• supermagle (unregistered)

    ... everything is permitted!

  • (nodebb)

    I have no idea which language that is, but it's most likely not C# because nullable value types exist there for two decades and that's exactly a case where you should use them :D

  • my name (unregistered)

    truely a guru: advancing from the file_not_found state to the state of nothing

  • Jonathan (unregistered)

    I've used a C# nullable bool on a UI to depict that neither "yes" or "no" has been chosen yet by the user and validation can fail on a null value in such cases.

    Maybe this was for a similar reason.

  • Jajcus (unregistered)

    Actually that is not that weird… SQL works fine with three-value logic (once one understands it). The problem starts when one would use that in regular binary boolean expressions, which C would happily allow and C++ would just warn about (tested with gcc). The code doesn't seem like either of those.

    Many other languages provide other means for presenting nullable boolean values or have more reasonable enums (like in Rust), which cannot be confused for other type.

  • (nodebb)

    Obviously it's meant to represent a qubit.

  • (nodebb)

    I can see using this in a language without nullable value support but not calling it "Bit." That implies you can perform logical operations on it, which you clearly can't.

  • Sheriff Fatman (unregistered) in reply to Jajcus

    I don't think it's the three-valued logic that's considered weird: it's the fact that this enum is called "Bit".

  • (nodebb) in reply to MaxiTB

    Yes of course C# has had nullable value types for years now, but still I'm pretty sure this enum is in C#.

  • Brian (unregistered) in reply to MaxiTB

    You must be new here ;) People being ignorant of language features is a rather common class of stories.

  • Gavin (unregistered) in reply to Mr. TA

    Quite. Just because a language has a feature, it does not mean the feature is actually used.

    Now let us consider a boolean in JavaScript - it may me true, it may be false, it may be null or even undefined. One more possibility, and I believe we will have the Ontological equivalent of the Big Bang.

  • Twither (unregistered)

    Without considering context, this enum could make perfect sense. In hardware modeling languages, three-state bits are a thing (actually four-state, but X isn't really an assignable value and its exclusion is not unreasonable): 0, 1, Z.

  • WilliamF (unregistered)

    Goddamnit Remy, I was about to take a "byte" of breakfast when I hit that pun.

  • Tim (unregistered)

    Pah - everyone knows that if there are 3 states, that's not a boolean, that's a "tri state boolean" - like this one https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.core.msotristate

    (for those that couldn't be bothered to click through, it has 5 possible values: True, False, CTrue, Mixed and Toggle)

  • DML (unregistered) in reply to Tim

    That's a funky one. I was going to mention boost::tribool ( https://www.boost.org/doc/libs/1_60_0/doc/html/tribool.html ) which has three states: true, false, and indeterminate. It does have some uses when you need to know if you don't yet know if something is true or false.

    This one though takes the cake with all the states it has. I particularly "like" -1 for "true," as it harkens back to the GW BASIC days where -1 (in that case, 0xFFFF or 16 1-bitss) was true vs 0 was false. Admittedly, that confused me tons as a kid until I later learned about 2's complement.

  • Sou Eu (unregistered)

    Definitely can't do bit logic with the elements of this enum. As others have said, having an enum entry for "NONE" or something else meaning value not set may not be the WTF the submitter paints it as. We don't know the language - though it looks like something from the C family - nor the year, so we can't know if a nullable boolean was natively available. The idea of it being used in a UI to distinguish FALSE from NOT YET SET / UNKNOWN makes sense. I wouldn't have called this enum "Bit" because the NONE entry can't be contained in a single bit and still be distinct from TRUE. Perhaps the name NullableBit or NullableBoolean would have been more descriptive.

  • see sharp (unregistered)

    DIY tristate... to be fair, IIRC the Win32 checkbox did this.

  • (nodebb)

    It's a nullable bit. It wouldn't be any more useful for logical operations without the -1 so this isn't horrible.

  • Duston (unregistered)

    Or maybe they're old and remember the RS-232 standard where +12 is High, -12 is Low and 0 means the cable was disconnected. Except maybe they remembered it wrong.

  • Mabs (unregistered) in reply to my name

    i came back to this site after like 15 years, and the first thing i read is this, file_not_found , i remember reading the original article so long ago haha, i see this is still a thing .

  • markm (unregistered)

    True, False, Uninitialized makes sense in many applications. It's generally an error if you try to use it while uninitialized, so use a nullable bit and throw an exception.

  • (nodebb) in reply to Sheriff Fatman

    Well it is a bit, it's just one that needs pullup resistors, and that you can wire-OR.

  • Maurizio (unregistered)

    Well, the real wtf is that like that is no more a bool algebra. Add the value "inconsistent", and you get an elegant, functional, even if somehow useless, bool algebra, with four values: "We know this thing is true", "We know this thing is false", "We don't know enough to affirm this thing is either true or false", "What we know is inconsistent, because we can prove this thing is false, and true at the same time"

  • Yazeran (unregistered) in reply to mynameishidden

    <quote>That implies you can perform logical operations on it, which you clearly can't.</quote>

    Sure you can, you just have to overload the logical operators to return -1 if any of the arguments is a '-1' Evil Grin

  • (nodebb) in reply to Maurizio

    Now you need to add two "discrepency" values (D and D') and you can run basic fault simulation and the Roth D-algorithm for test generation.

  • piqpoq (unregistered)

    It's bad, but if they'd at least name it a trit, it'd be potentially understandable, if still bad.

Leave a comment on “Nothing is True”

Log In or post as a guest

Replying to comment #:

« Return to Article