- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
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.
Admin
<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?
Admin
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.
Admin
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.
Admin
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
Admin
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
Admin
The Boolshit.
Admin
I think you'll find any elephant can fly given a large enough catapult. It's the landings they haven't mastered yet.
Admin
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.
Admin
Const Maybe as Int = -0.5
Admin
No, that returns KindaSortaNotReally!
Admin
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
Admin
<FONT face="Courier New" size=2>trojoins: now in antler purple and trunk orange.</FONT>
Admin
Surely you mean
Const Maybe as Int = -0.5
Admin
IsTrue(KindaSortaNotReally) should return KindaSortaNotReally.
Think about it. IsTrue(True) returns True, and IsTrue(False) returns False.
Admin
I reject your bool, and substitute my own.
Admin
Aha! I always wondered how Heinlein's trinary logic computers (see Number of the Beast) were supposed to work. Now I know!
tekra
Admin
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 ;-)
Admin
Admin
Huh..
I like this one:
:)
Admin
Shurely:
enum Bool
{
False,
True,
X,
N
};
?
Admin
... But what a better state than this:
enum Bool
{
True,
False,
Both
};
Admin
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
Admin
Admin
Buddhist logic has this:
All the while Jainist logic has this:
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.Admin
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.
Admin
Admin
Ye are all a bunch of wasters and need to get out more
Admin
Amen to that. K-maps are so much more convenient with don't-cares on them!
Admin
enum IsThisLove { no, yes, dunna }
Admin
Baby don't cast me Don't cast me No more
Admin
static class Madhyamaka {
enum SCOPE { ULTIMATELY, CONDITIONALLY };
static boolean exists(SCOPE scope, boolean isValid) { switch (scope) {
}
Admin
Clearly, Bool is either True, False or ⊥
Admin
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.
Admin
Oh no, not at all. This post has acquired cult status here, and does get "referenced" about 5 times per post.
Admin
Wait? What about "Insert next disc to continue"?
Admin
Reminds me of c-plus-equality, fixing C++ not to be such a sexist language.
Also see https://gitorious.org/c-plus-equality/c-plus-equality/source/cefcfb4276889bd3833c539225a9cdfd3eb16d33:assets/flowcharts/BooleanPlus.png
for a cleaner definition of Bool.
Admin
using namespace std;
enum Bool { True, False, FileNotFound };
int main() { Bool b = True;
}
What is the output? A: eslaf = b
Admin
true, false, null, undefined
Admin
Admin
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
Admin
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... :-)
Admin
enum Bool { Rock, Paper, Scissors };
Admin
We are in a age where we can introduce also AltFalse, FalseFalse, TrueTrue, TrueFalse, FalseTrue, FlatFalse, FlatTrue and why not, GreenTrue and GreenFalse (or maybe TrueGreen and FalseGreen?)
Admin
Let's fix this!
Admin
They smoked something, but it wasn't that strong.
Admin
Huh, I became a thread-necromancer.
Admin
Of course it's True, False and Unknown!!!! But please no Hollywood logic...i.e. what is "your" truth. There can only be 3.