• (cs) in reply to rikkus
    rikkus:
    Anonymous:

    The more subtle WTF is that, by default, True is 0 and False is 1.  Which is completely bass-ackwards.

    UNIX would beg to differ:

    
    > [ -d / ]; echo $?
    0
    > [ -f / ]; echo $?
    1
    


    I take it you're assuming that UNIX is not completely bass-ackwards?
  • joe_bruin (unregistered) in reply to johnl

    This is clearly forward-thinking code.  A tri-state bool is what you would expect to find on a trinary-based architecture.  If a bit (trit?) equals 2, perhaps that means FileNotFound.  Some of us are still not ready for this mind blowing scenario where each bit can be true, false, or 404nf, but this code is clearly ready to be ported to these computers if and when they are created.  How many of you can claim to have written code with such portability in mind?

  • (cs) in reply to joe_bruin

    If I were to take a guess ...

    C, before the C99 standard, didn't have a boolean type. Results were manyfold, such as (WinAPI):
    typedef int BOOL;
    #define TRUE 1
    #define FALSE 0

    Or
    typedef enum { false, true } bool;


    Now, this application might be C (or early C++, which didn't have a bool either), and this particular app had the rather fucked-up
    enum Bool {
      True,
      False
    };
    (Fucked-up because that makes True=0 and False=1, and C evaluates everything != 0 as true.)
    This might have been used as a process exit code, where 0=success. Now, this little app (a shell utility perhaps) opened a file, checked the contents for some condition, and returned, giving the appropriate status.

    int main(int argc, char **argv)
    {
      FILE *f = fopen(argv[1], "rt");
      // Read and guess.
      fclose(f);
      if(content_fulfilled_condition()) {
        return True;
      } else {
        return False;
      }
    }


    And then somebody came along and asked, "But what if the file isn't found?"


    That doesn't make it any less of a WTF, but I suppose that's how such a WTF would come to be.

  • (cs) in reply to vhawk
    Anonymous:
    We all know this is wrong ...

    Should have been

    enum Bool 
    {
    True,
    False,
    DefiniteMaybe
    };


    Or the seemingly more decisive:
    enum Bool 
    {
    True,
    False,
    ProbablyButIDoubtIt
    };

  • (cs) in reply to joe_bruin
    Anonymous:
    This is clearly forward-thinking code.  A tri-state bool is what you would expect to find on a trinary-based architecture.  If a bit (trit?) equals 2, perhaps that means FileNotFound.  Some of us are still not ready for this mind blowing scenario where each bit can be true, false, or 404nf, but this code is clearly ready to be ported to these computers if and when they are created.  How many of you can claim to have written code with such portability in mind?


    I've always favored calling a trinary digit a tit.
  • David Barrett (unregistered) in reply to emptyset

    Would you be using the traditional transmogrifier/duplicator or do you have one of the newer portable versions?


  • Dwayne (unregistered) in reply to Paul O
    Anonymous:

    [Any other 'unregistered' users noting the captcha verification misses the first word sometimes?]


    Yup.
  • Jerry Pisk (unregistered) in reply to jvancil
    jvancil:
    fregas:

    All my apps have the following enum:

    public enum MostlyBool
    {
      True,
      False,
      KindaSortaNotReally
    }

    But... what does IsTrue(KindaSortaNotReally) return? We need another level of the enum for... "Probably"

    IsTrue returns MostlyBool, so IsTrue(KindaSortaNotReally) will return KindaSortaNotReally. That's the whole point of the IsTrue function, to just return what you pass in.

  • (cs) in reply to RevMike
    RevMike:
    Alex Papadimoulis:

    The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc. Thankfully, there are some among us, like Mark Harrison's colleague, who are not afraid to stand up to these logic advocates and shout "no, I will not succumb to your false dichotomies!" Today, I think we all should salute those few brave people ...

    enum Bool 
    {
    True,
    False,
    FileNotFound
    };


    Us SQL developers know this should really be
    enum Bool 
    {
    True,
    False,
    NULL
    };



    We developers...
  • (cs) in reply to ???
    Anonymous:
    tmountjr:
    Const True as Int = -1
    Const False as Int = 0
    Const Maybe as Int = 0.5


    0.5 as an Integer..... very interesting! ^o)


    Should array indices start at 0 or 1?  My suggested compromise of 0.5 was rejected without, I thought, proper consideration.
                  -- Stan Kelly-Bootle


    ok
    dpm
  • (cs) in reply to WTFer
    WTFer:
    RevMike:
    Alex Papadimoulis:

    The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc. Thankfully, there are some among us, like Mark Harrison's colleague, who are not afraid to stand up to these logic advocates and shout "no, I will not succumb to your false dichotomies!" Today, I think we all should salute those few brave people ...

    enum Bool 
    {
    True,
    False,
    FileNotFound
    };


    Us SQL developers know this should really be
    enum Bool 
    {
    True,
    False,
    NULL
    };


    Us Electronic Engineers now that it should really be



    We Electronic Enginneers...

    (sorry, the first one was midly annoying but I had a laugh when I saw the second one)
  • uh oh. (unregistered) in reply to kipthegreat

    in which case 9 tits would be tyte

     

  • (cs) in reply to dubwai
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Quite possibly the funniest post i've ever seen on this site.

    Bravo.

         -dave-

  • uh oh. (unregistered) in reply to uh oh.

    so shouldn't we replace booleans with a 3 dimesional float vector?

     1) trueness : -1.0f =completely false, 1.0f =completely true

    2) reliability: -1.0f=not at all sure about axis 1, 1.0f=absolutely confident

    3) how much i #$%ing care: -1.0f= i don't care at all, 1.0f = it really matters to me

     

  • (cs) in reply to Mung Kee
    Mung Kee:
    RevMike:
    Us SQL developers know this should really be
    enum Bool 
    {
    True,
    False,
    NULL
    };

    We developers...

    Or maybe, "US SQL developers . . .".  (It might not be bad grammar.  It could be nationalism.)

    Sincerely,

    Gene Wirchenko

  • RandomPunter (unregistered) in reply to Enric Naval
    Enric Naval:

    In one app of mine, to see if the user can edit fields in a form:

    public enum Editable { YES, NO, DISABLED, READONLY; }

    The last three values mean "no" :)


    Disabled and readonly... I presume readonly would still allow the user to select the text in the field and copy it, whereas disabled means they can't even select it? Dunno what NO means from UI perspective... not even visible?
  • (cs) in reply to Mung Kee

    Oh for god's sake Mung Kee be quiet. The guy's probably British and this is common slang in Britain.

  • (cs) in reply to Jerry Pisk
    Anonymous:
    jvancil:
    fregas:

    All my apps have the following enum:

    public enum MostlyBool
    {
      True,
      False,
      KindaSortaNotReally
    }

    But... what does IsTrue(KindaSortaNotReally) return? We need another level of the enum for... "Probably"

    IsTrue returns MostlyBool, so IsTrue(KindaSortaNotReally) will return KindaSortaNotReally. That's the whole point of the IsTrue function, to just return what you pass in.

    Then we should deprecate the IsTrue function and replace it with the ItIsWhatItIs function.

  • robbak (unregistered) in reply to dubwai
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Incorrect. The statment is undefined.
  • (cs) in reply to robbak
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Not so sure about that.  Should the statement look a bit more like:

    if((deep-sea dwelling elephants exist) && (all deep-see dwelling elephants can fly)){} ??

    if there are no deep-sea dwelling elephants the statement evaluates to false and doesn't evaluate the other half, thus no NullReferenceException.

    My $.02

  • (cs) in reply to Kaizer

    "Disabled and readonly... I presume readonly would still allow the user to select the text in the field and copy it, whereas disabled means they can't even select it? Dunno what NO means from UI perspective... not even visible?"

    Well, since the enum in that example is called Editable, I guess that whether the user can select the text is irrelevant - I only care whether they can edit it. Still a WTF, though.

  • (cs) in reply to johnl
    johnl:
    Well, since the enum in that example is called Editable, I guess that whether the user can select the text is irrelevant - I only care whether they can edit it.


    Exactly...

    class TextBox
    {
        bool Editable;
        bool Selectable;
    }

    Editable && Selectable -> YES
    !Editable -> NO
    !Editable && Selectable -> READONLY
    !Editable && !Selectable -> DISABLED
    Editable && !Selectable -> WTF
  • (cs) in reply to Kaizer
    Kaizer:
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Not so sure about that.  Should the statement look a bit more like:

    if((deep-sea dwelling elephants exist) && (all deep-see dwelling elephants can fly)){} ??


    That is a different statement.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to Gene Wirchenko
    Gene Wirchenko:
    Kaizer:
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Not so sure about that.  Should the statement look a bit more like:

    if((deep-sea dwelling elephants exist) && (all deep-see dwelling elephants can fly)){} ??


    That is a different statement.

    Sincerely,

    Gene Wirchenko

    Oh.. yah, my bad... I meant 'deep-sea' not 'deep-see'...

     

    But seriously, we are trying to evaluate wether a statement is true or not.  If there are no deep-sea dwelling elephants (which is getting annoying to type) than the statement should automatically be false.

  • phx (unregistered) in reply to Ribert
    <FONT size=2>

    </FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>enum</FONT><FONT size=2> DatabaseResult

    {

    Success,

    SuccessWithMessage,

    SuccessNoRecords,

    Failure,

    FailureContinue,

    FailureInUse

    }

     

    :(

    </FONT>
  • (cs) in reply to Mung Kee
    Mung Kee:
    RevMike:
    Alex Papadimoulis:

    The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc. Thankfully, there are some among us, like Mark Harrison's colleague, who are not afraid to stand up to these logic advocates and shout "no, I will not succumb to your false dichotomies!" Today, I think we all should salute those few brave people ...

    enum Bool 
    {
    True,
    False,
    FileNotFound
    };


    Us SQL developers know this should really be
    enum Bool 
    {
    True,
    False,
    NULL
    };



    We developers...


    You haven't heard of the new database called "Us SQL"?  :)  Its pretty cool.  It uses advanced regex technology to be fully text searchable in O(1).
  • Paul O (unregistered) in reply to Kaizer

    "If there are no deep-sea dwelling elephants ... than (sic) the statement should automatically be false."

    Now, now.  Don't start a whole new WTF in the middle of this one.

    Bad enough to display the weaknesses in your own education, without nearly begging others to comment on them.

    I don't know why someone would work in a field so embued with logic without an understanding of logic.  But so it goes.

    Your homework for the evening is to google the word "syllogism" and read and understand what one is.  And when one is true, and when one is false, and when one is File Not Found.  Er ... ignore the third part of that.

    [Captcha validation rejected "algebra". Grr.]

  • (cs) in reply to johnl
    johnl:
    Oh for god's sake Mung Kee be quiet. The guy's probably British and this is common slang in Britain.


    British?  Oh God, No!  I'm New York Irish.   I just wasn't paying attention.  However in a reply to Mung Kee, I made an intentional mistake to see if he would take the bait.  All Hail Kibo!
  • (cs) in reply to James Schend
    Anonymous:
    Whose turn is it to explain why this isn't all that bad after-all?


    I'll give it a shot...

    The programmer was enumerating the return types of a function or method whose job was to inspect a file.  The program in question has some property named Bool which is set true or false depending on some aspect of some file.  The getBool function/method attempts to examine the file and return the proper Bool state,  The return types could reasonably be true, false, and file not found.

    Now, the choice of the name Bool was unfortunate, but they are really checking for the something having to do with a Pool.  They used the word Bool instead of Pool because B and P sort-of  look alike, and they prefer their Pool to not have P in it.
  • (cs) in reply to Paul O

    Anonymous:
    "If there are no deep-sea dwelling elephants ... than (sic) the statement should automatically be false."

    Now, now.  Don't start a whole new WTF in the middle of this one.

    Bad enough to display the weaknesses in your own education, without nearly begging others to comment on them.

    I don't know why someone would work in a field so embued with logic without an understanding of logic.  But so it goes.

    Your homework for the evening is to google the word "syllogism" and read and understand what one is.  And when one is true, and when one is false, and when one is File Not Found.  Er ... ignore the third part of that.

    [Captcha validation rejected "algebra". Grr.]

    How's this for a Syllogism:

    If you're a logged in as a registered user you don't have to use the captcha.
    If you don't don't have to use the captcha the board doesn't reject your messages.
    Therefore, If you're logged in as a registered user the board doesn't reject your messages.

    Granted it should work, but get over it.

     

  • (cs) in reply to RevMike

    RevMike:

    You haven't heard of the new database called "Us SQL"?  :)  Its pretty cool.  It uses advanced regex technology to be fully text searchable in O(1).

    That's caching, BTW.[8-|]

  • (cs) in reply to uh oh.
    Anonymous:

    in which case 9 tits would be tyte

     

     

    and...

    3 tits would be a tybble

    3 tytes would be a tyurd

    3 tyurds would be a long tyurd

  • php programmer (unregistered) in reply to RevMike
    RevMike:
    Anonymous:
    Whose turn is it to explain why this isn't all that bad after-all?


    I'll give it a shot...

    The programmer was enumerating the return types of a function or method whose job was to inspect a file.  The program in question has some property named Bool which is set true or false depending on some aspect of some file.  The getBool function/method attempts to examine the file and return the proper Bool state,  The return types could reasonably be true, false, and file not found.


    In that case they should have written their own homegrown "verifyFileExists(File f) throws FatalErrorNotFoundException" function to check beforehand.


  • (cs) in reply to johnl
    johnl:
    Oh for god's sake Mung Kee be quiet. The guy's probably British and this is common slang in Britain.


    It's actually quite common here too.  After all, we are spawned from the UK.  I would argue that we do a much better job of mutilating the language than you chaps.  Although I am a stickler for good grammar, I was a light-hearted joke.
  • (cs) in reply to Otac0n
    Otac0n:
    Anonymous:

    in which case 9 tits would be tyte

     

     

    and...

    3 tits would be a tybble

    3 tytes would be a tyurd

    3 tyurds would be a long tyurd



    Can you flush tyurds or are they immutable?  I know the long ones can hang around for a while.
  • (cs) in reply to James Schend
    Anonymous:
    Whose turn is it to explain why this isn't all that bad after-all?
    Depending on the context & language, something like this wouldn't necessarily be bad:
    enum SafeBool
        {
        Undefined = -9999,
        False = 0,
        True = 1,
        }

    var bValue = Undefined;

    To account for a boolean value that has no good default, where you really want to make sure the value has been explicitly set somewhere before you try to use it, you need some magic value to start the variable out with. AFAIK, no language accounts for such a value perfectly. In JavaScript you can set it to NaN (not a number) or null. In this case, "if (bValue)" fails, "if (!bValue)" succeeds, and "if (bValue==false)" & "if (bValue==true)" both fail. In C/C++, if you define bValue as int & set it to -9999, then "if (bValue)" succeeds & "if (!bValue)" fails because bValue is not zero. Yuck! Although "if (bValue==FALSE)" & "if (bValue==FALSE)" would both fail.

    I guess what we need is a new boolean value: "undef". How about this:

    bool bValue = undef;

    if (?bValue)
        {alert ("It's undefined!");
        }

    Or maybe this:

    if (bValue==???)
        {alert ("It's undefined!");
        }

    Add a rule to the language that both "if (bValue)" and "if (!bValue)" would fail, but "if (?bValue)" succeeds.

    I like it!

     

  • simon m (unregistered) in reply to Mung Kee

    "...I was a light-hearted joke..."

    a sad admission indeed :?)

  • Rolf (unregistered) in reply to Wang
    Anonymous:
    or indeed true, false or null...


    I beleive even great minds at Oracle find this to be True (if not nullable).
  • (cs) in reply to Kaizer
    Kaizer:

    But seriously, we are trying to evaluate wether a statement is true or not.  If there are no deep-sea dwelling elephants (which is getting annoying to type) than the statement should automatically be false.



    Ex Falso Quodlibet
  • Urkki (unregistered) in reply to emptyset
    emptyset:

    <font face="Courier New" size="2">wait, wouldn't this assign:</font>

    <font face="Courier New" size="2">True <- 0
    False <- 1
    FileNotFound <- 2</font>

    <font face="Courier New" size="2">in C/C++?  what language is this?</font>


    If there is only one "true" value, and several "false" values, it makes perfect sense to decide that 0 is true and everything else is false.  Kinda like program return codes.  Of course it would make even more sense if instead of "True" he'd call it "Ok", "Valid", "Success" or whatever else (and same for "False).
  • (cs) in reply to johnl
    johnl:
    "Disabled and readonly... I presume readonly would still allow the user to select the text in the field and copy it, whereas disabled means they can't even select it? Dunno what NO means from UI perspective... not even visible?" Well, since the enum in that example is called Editable, I guess that whether the user can select the text is irrelevant - I only care whether they can edit it. Still a WTF, though.

    The WTF here is that with "readonly", the value in the field appears automatically in the request, but they preferred "disabled" because they liked better the grey-shaded look in Internet Explorer.

    So now I have to put a hidden input after each disabled field so that the field will appear on the request.

    "no" causes the value to be returned as a string. It's very useful to inline answers from the user: "Remember that in the former page you answered 1,245 KM. way smaller than Jupiter for the radius of Mars", where the bold text is actually

    Remember that in the former page you answered 
      <%= answer.textarea("f02",Editable.NO) %>
    for the radius of Mars.
    

    and "f02" was a medium-sized textarea in the former page:

    <%
      Editable editable;
    

    if ( user.canEdit() ) { editable = Editable.YES; } else { editable = Editable.DISABLED; } %>

    <p>Radius of Jupiter:</p> <%= answer.textinput("f01",editable) %>

    <p>Radius of Mars. Compare it to Jupiter radius:</p> <%= answer.textarea("f02",editable) %>

    <p>Name at least three craters on the Moon:</p> <%= answer.textarea("f03",editable) %>

    <p>Explain how craters are formed:</p> <%= answer.textarea("f04",editable) %>

    In the former page, if I had used "no" the text would occupy a different space and shape than a disabled textarea, so it would look ugly, and it would break some places where I used textareas inside of tables.

  • (cs) in reply to Enric Naval

    Then again, maybe I should have selected more meaningful names but I couldn't come up with anything more coherent :-)

  • (cs) in reply to tmountjr

    tmountjr:
    Const True as Int = -1
    Const False as Int = 0
    Const Maybe as Int = 0.5


     

    Shouldn't it be Maybe Int = -0.5 as it is half way between true and false?

  • Thomas Magle Brodersen (unregistered)

    No, no, no! Remember the teachings of Master Yoda: "Always two there are..."

  • Lars Thegler (unregistered)

    Animals are divided into:

    • (a) belonging to the Emperor,
    • (b) embalmed,
    • (c) tame,
    • (d) suckling pigs,
    • (e) sirens,
    • (f) fabulous,
    • (g) stray dogs,
    • (h) included in the present classification,
    • (i) frenzied,
    • (j) innumerable,
    • (k) drawn with a very fine camel hair brush,
    • (l) et cetera,
    • (m) having just broken the water pitcher, and
    • (n) that from a long was off look like flies.
  • (cs) in reply to faded_fear

    Well that is exactly the bug I'm fighting with in the JDK>1.4 and boolean :
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206469

    VB code using the Java-activeX plug-in:

    dim result as Boolean
    result=callToJavaMethodReturningABoolean

    If result Then
    msgbox("maybe")
    else if not result
    msgbox("maybe")
    else
    ' strange logic isn't it...
    msgbox("wahoo")
    End If

    Result with the ActiveX-Java plug-in: wahoo!

    Impressive isn't it?


  • (cs) in reply to Kaizer
    Kaizer:
    Gene Wirchenko:
    Kaizer:
    dubwai:

    I don't think people are seeing the value in this.

    In standard logic, the statement "all deep-sea dwelling elephants can fly" is true.  With this addition, the answer is now FileNotFound; a much more satisfying answer.



    Not so sure about that.  Should the statement look a bit more like:

    if((deep-sea dwelling elephants exist) && (all deep-see dwelling elephants can fly)){} ??


    That is a different statement.

    Sincerely,

    Gene Wirchenko

    Oh.. yah, my bad... I meant 'deep-sea' not 'deep-see'...

    But seriously, we are trying to evaluate wether a statement is true or not.  If there are no deep-sea dwelling elephants (which is getting annoying to type) than the statement should automatically be false.

    It's also different because your proposition requires that deap-see dwelling elephants exists, whereas the original proposition does not.

    Consider:

    for each elephant e providing that e dwells in the deep sea it can be said that e can fly

    This is true, simply because there are no elephants that are deep-sea dwellers (although... have you checked?)

    Similarly, any statement that says something about all elements an empty domain is true. On the other hand, if you would make a statement about the existence of a flying deep-sea dwelling elephant, that would be a different story.

    there exists an elephant e providing that e dwells in the deep sea for which e can fly

    Obviously not true. Not even because of the flying part, but simply because the domain is empty. Existence over an empty domain is always false.

    Now why is this the case? Because a for-all quantor is simply a connected series of conjunctions (ANDs), like this:

    for all s === s0 AND s1 AND s2 AND ...

    Since true is the identity of the AND operator, the conjunction of no statements is true (just like the sum of no elements is 0 (0 is the identity of +), or the 0th power of no elements is 1 (1 is the identity of *)). And the same thing with a there-exists quantor: empty domain results in false, which is the identity of the disjunction (OR) operator.

  • Oli (unregistered)

    enum Bool
    {
        True,
        False, 
        LOL

    };

  • (cs) in reply to RiX0R
    RiX0R:

    or the 0th power of no elements is 1 (1 is the identity of *)).

    Whoops, I did a mental copy/paste there. That should of course have been the 0th power of any number (In my mind I was picturing the list of multiplications. Yeah. That's the ticket.)

    Stupid edit time limit.

  • Oli (unregistered) in reply to faded_fear

    tmountjr:
    Const True as Int = -1
    Const False as Int = 0
    Const Maybe as Int = 0.5

     

    It would have to be declared as a Single as an Int is for whole numbers only

Leave a comment on “What Is Truth?”

Log In or post as a guest

Replying to comment #:

« Return to Article