• rp (unregistered) in reply to anon

    In Unix, true and false are indeed files.

    In Solaris, they are shell scripts; /bin/true consists of a copyright statement. This raises interesting questions on what would constitute a "copy" or "derived work" in the sense of copyright law. The copyright holder may argue that when you create an empty file, you violate their IP on /usr/bin/true, and make matters worse by omitting their copyright statement.

  • =:-O (unregistered) in reply to smudge

    <i>PS. Do you think that sometimes Schrodinger opened his lunch box and his sandwiches were there, and sometimes, they weren't?</i>
    <P>
    Not sure...were his sandwiches smaller than an Angstrom unit?

  • (cs)

    Yup.  There are truly two schools of thought here.  You either believe in zero, or you believe there is always a half-of-a-half-of-a-half...  At some point, ya gotta choose - embrace the boolean or sit on the fence.

  • J.Mayo (unregistered)

    I don't really have a problem with this, other than naming it Bool. But it's pretty common. Someone decides that a function returns True or False. So they go "hey, I'll have it return a Bool". But then they need to handle an exceptional case later and add another return value so they can monitor this case. An example might be:

    Bool IsUserFound(const char *filename, const char *username);

    but if you pass a filename that does not exist, you would probably treat it as False. but you would also want to know if the file didn't exist. I would use an exception. In C I might do this as:

    Bool IsUserFound(const char *filename, const char *username, jmp_buf except);

    or if I was using C++ (which I don't do) I would use a class and exception.

  • (cs) in reply to J.Mayo

    Good Post. - Yeah. that's a tough call. The purity of a boolean function is always tempted by the growth of the application.  I'm, not sure a class is needed to solve it, but it does provide a quick solution,, and at the same time, it's a signal that the application needs better logic

  • Nat (unregistered) in reply to johnl

    Please select one of the following two options (guess which one isn't an option!):

    [Abort] [Retry] [Ignore]

    Actually I'm thinking ... if this C#/C++ where bool instead of Bool (as one person already mentioned) is the reserved word, then maybe Bool means something different, like two bools? So like a bool with one child being a value and the other another bool, proving a total of three options? A boolette? Nested bool? Bool inheritance?

    :D

  • phx (unregistered) in reply to Nat

    Anonymous:
    Please select one of the following two options (guess which one isn't an option!):

    [Abort] [Retry] [Ignore]

    Actually I'm thinking ... if this C#/C++ where bool instead of Bool (as one person already mentioned) is the reserved word, then maybe Bool means something different, like two bools? So like a bool with one child being a value and the other another bool, proving a total of three options? A boolette? Nested bool? Bool inheritance?

    :D

    The Boolshit.

  • Anonymous (unregistered) in reply to php programmer

    Anonymous:


    About the flying sea elephants:

    I think what is said, is if "all the elephants under the sea can fly" and you ask  "are there any elephants under the sea that can't fly?" you have to respond "there are no elephants that can't fly under the sea."  If there are no elephants under the sea that can't fly, then can't they all fly down there?   They all can pass the test, all zero of them.  Of course "all the elephants under the sea can't fly" is also true, so it is not a statement of actual boolean logic (any more than filenotfound)

    I think you'll find any elephant can fly given a large enough catapult. It's the landings they haven't mastered yet.

  • dasmb (unregistered) in reply to tmountjr

    Two great things about this.

    First, since you're using integers,.5 will round up to 1 (unless you have option strict on, then it'll spank you.  which is why you should have option strict on).

    Second, 1 is obvious not in between -1 and 0 as you intended, making "maybe" even more false than false.

    Come to think of it, when my wife says "maybe," that's exactly what it means.

  • I (unregistered) in reply to tmountjr

    Const Maybe as Int = -0.5

  • Thygrrr (unregistered) in reply to jvancil
    jvancil:

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



    No, that returns KindaSortaNotReally!
  • smithy (unregistered)

    it is obvius it is designed to confuse low grade hackers their is only 2 answers no three thees are yes firle not found it is a cover for some trojions

  • (cs) in reply to smithy

    Anonymous:
    it is obvius it is designed to confuse low grade hackers their is only 2 answers no three thees are yes firle not found it is a cover for some trojions

    <FONT face="Courier New" size=2>trojoins: now in antler purple and trunk orange.</FONT>

  • Csaba (unregistered) in reply to tmountjr

    Surely you mean

    Const Maybe as Int = -0.5

  • Personman (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(KindaSortaNotReally) should return KindaSortaNotReally.
    Think about it.  IsTrue(True) returns True, and IsTrue(False) returns False.
  • JWhite (unregistered)

    I reject your bool, and substitute my own.

  • tekra (unregistered) in reply to JWhite

    Aha! I always wondered how Heinlein's trinary logic computers (see Number of the Beast) were supposed to work. Now I know!
    tekra

  • Andr&#233; (unregistered)

    Actually, Progress 4GL has this built in.
    All Progress data types can take the unknown value, ie. ?
    So if I write

    define variable ltest as logical no-undo.
    ltest = ?.

    if ltest then do: /* won't be executed /
    end.

    if not ltest then do: /
    won't be executed */

    end.

    if ltest <> true then do: /* will be executed */

    end.

    Can be useful sometimes...
    And you get used to using case-statements for boolean variables ;-)

  • Stupidumb (unregistered)

    enum Bool 
    {
    True,
    False,
    Bool
    };

    That's better...

  • Exception (unregistered)

    Huh..
    I like this one:

    enum Bool 
    {
    True,
    False,
    WTF
    };

    :)

  • Anonymous (unregistered) in reply to Exception

    Shurely:

     

    enum Bool

    {

       False,

       True,

       X,

       N

    };

     

    ?

  • MDalrymple (unregistered) in reply to vhawk

    ... But what a better state than this:

    enum Bool

    {

        True,

        False,

        Both

    }; 

  • deep (unregistered)

    truth is relevance (not relative). in a binary world you can make relevance palatable by calling it true or false. nevertheless just calling it 'true' doesn't make it true. you could also declare the essential types as tastiness and define the quality yummy and ucky but thats less relevant than 'true' or 'false' unless of course you are a glutton and perhaps have a penchant for obese code. or.. you are writing a recipe evaluator. bottom line... your 'file not found' is only relevant to a cake, delivered in a 1950's comedy

  • Dennis (unregistered)
    enum BossOfMe
    { 
        Yes, 
        No,
        Maybe,
        IDontKnow,
        CouldYouRepeatTheQuestion
    };
    
  • alexgieg (unregistered) in reply to Dennis

    Buddhist logic has this:

    enum reality {
        True,
        False,
        Both,
        Neither,
        Enlightenment
    };

    All the while Jainist logic has this:

    enum reality {
        True,
        False,
        Unknown,
        TrueAndFalse,
        TrueAndUnknown,
        FalseAndUnknown
        TrueAndFalseAndUnknown,
        Enlightenment
    };
    And yes, I'm being serious. But the actual reason is that both logical systems don't take dialectic and syllogistic reasoning as independent fields, while Greek philosophy prefers the opposite approach.
  • George Bush (unregistered) in reply to RiX0R

    All deep-sea elephants can fly =

    ∀(x) ((deep-sea-elephant? x) -> (can-fly? x)) [1]

    Since the hypothesis is always false, the statement (1) is automatically true.

    ∃(x) ((deep-sea-elephant? x) ∧ (can-fly? x)) [2]

    Since the deap-sea-elephant part is always false, the statement is false.

  • Conio (unregistered) in reply to tmountjr
    tmountjr:
    Const True as Int = -1 Const False as Int = 0 Const Maybe as Int = 0.5
  • Raftorian (unregistered)

    Ye are all a bunch of wasters and need to get out more

  • Frodo B (unregistered) in reply to WTFer
    WTFer:
    That would be: enum Bool{ VCC, GND, Z }

    Amen to that. K-maps are so much more convenient with don't-cares on them!

  • Stranger (unregistered)

    enum IsThisLove { no, yes, dunna }

  • JAB (unregistered)

    What Is Truth?

    Baby don't cast me Don't cast me No more

  • JP (unregistered) in reply to JAB

    static class Madhyamaka {

    enum SCOPE { ULTIMATELY, CONDITIONALLY };

    static boolean exists(SCOPE scope, boolean isValid) { switch (scope) {

     case ULTIMATELY:
      return !true
          && !false,
          && !(true && false),
          && !(!true && !false);
     case CONVENTIONALLY:
       return isValid;
    }
    

    }

  • Anonymous (unregistered)

    Clearly, Bool is either True, False or ⊥

  • Shane (unregistered)

    While most people have largely forgotten this submission, I actually stumbled upon a webpage highlighting its use: www.vbtonet.com/ewis/ewi6021.aspx. Whether it's the true source of this submission or some employee felt a duty to honor it, I suppose only Alex will know.

  • Forgot (unregistered) in reply to Shane
    Shane:
    While most people have largely forgotten this submission

    Oh no, not at all. This post has acquired cult status here, and does get "referenced" about 5 times per post.

  • Kyle (unregistered)

    Wait? What about "Insert next disc to continue"?

  • BoolDefiner (unregistered)

    Reminds me of c-plus-equality, fixing C++ not to be such a sexist language.

    std::mt19937 feelings(time(NULL));
    #define no 0
    #define yes 0
    #define on_alternative_success catch
    #define maybe if
    #define perhaps(X) if(((int)(request(feelings))) == 0)
    #define please honors(request(feelings), 0.8) //80% change of returning true
    #define perhaps_and_equally_valid else
    

    Also see https://gitorious.org/c-plus-equality/c-plus-equality/source/cefcfb4276889bd3833c539225a9cdfd3eb16d33:assets/flowcharts/BooleanPlus.png

    for a cleaner definition of Bool.

  • Yeah (unregistered)

    using namespace std;

    enum Bool { True, False, FileNotFound };

    int main() { Bool b = True;

    if(b) {
    	cout << "b = true" << endl;
    } else {
    	cout << "b = false" << endl;
    }
    return 0;
    

    }

    What is the output? A: eslaf = b

  • tim (unregistered) in reply to Wang

    true, false, null, undefined

  • WarpspeedSCP (github) in reply to tmountjr
    const float true = 1
    const float false = 0
    const float maybe = 0.5
    
  • Anon (unregistered)

    Just today, in DevExpress components:

    Namespace DevExpress.Utils ' ' Summary: ' Lists values which specify the validity of a condition (indicates whether the ' condition is true or false). <ResourceFinder(GetType(Data.ResFinder))> <TypeConverter(GetType(DefaultBooleanConverter))> Public Enum DefaultBoolean ' ' Summary: ' Corresponds to a Boolean value of true. [True] = 0 ' ' Summary: ' Corresponds to a Boolean value of false. [False] = 1 ' ' Summary: ' The value is determined by the current object's parent object setting (e.g., ' a control setting). [Default] = 2 End Enum End Namespace

  • Mike (unregistered)

    Nice variant of the truth too: typedef enum {True=1,False=0,Yes=1,No=0,Set=1,Reset=0,OK=1} Boolean Found in a german/netherland software - don't ask why there are no definitions like Ja=1,Nein=0... :-)

  • April (unregistered)

    enum Bool { Rock, Paper, Scissors };

  • Ulf T (unregistered)

    We could introduce "AltTrue"

Leave a comment on “What Is Truth?”

Log In or post as a guest

Replying to comment #:

« Return to Article