-
Sep 13th, 2015, 10:22 AM
#1
Thread Starter
Hyperactive Member
MSDN: A tri-value boolean, which can have five values, but only two are supported.
https://msdn.microsoft.com/en-us/lib...ice.12%29.aspx
This is an actual thing that shows that Microsoft (or some intern a long time ago) does not know the purpose of a Boolean. It's used instead of Booleans all over the place if you do Office automation. (The Office automation api is one massive ***. Pray to deity that you'll never have to build something that automates Office).
Well it is three states. True, False, and Not Supported.
Microsoft is already transitioning to quantum computing. We just didn't know that yet.
- The problem is that they don't know it either.
Last edited by MikiSoft; Sep 13th, 2015 at 10:54 AM.
-
Sep 13th, 2015, 12:31 PM
#2
Re: MSDN: A tri-value boolean, which can have five values, but only two are supported
-
Sep 13th, 2015, 07:12 PM
#3
Re: MSDN: A tri-value boolean, which can have five values, but only two are supported
The general situation shows up all the time. You have things like the tri-state checkbox, and a Boolean in most DB systems can be in three states if you count Null...which you should, since it's a state.
Essentially, they are reflecting a reality. I agree that a Boolean technically has only two states, but there are lots of three-state situations and after that it is just a matter of choosing a name.
My usual boring signature: Nothing
-
Sep 13th, 2015, 07:28 PM
#4
Re: MSDN: A tri-value boolean, which can have five values, but only two are supported
Excellent point regarding Null in DBMS fields.
-
Sep 14th, 2015, 03:04 PM
#5
Re: MSDN: A tri-value boolean, which can have five values, but only two are supported
I usually like to be a Devil's Advocate and explain a sensible way one might end up with this silly API through a series of bad choices that seem harmless at the time.
I think I'd have to do way too much API research to figure this one out. "True" and "False" make sense in a VB context. "CTrue" is weird, in C 0 is false and everything else is true, so I don't understand why it needed its own special one since VB's True ought to be True in any sensible C environment? "Mixed" vaguely makes sense as the third state, but "Toggle" just confuses me. And they're all "Not Supported".
All I can figure is they started out with the notion that they needed a boolean parameter for some behavior, but might in the future add a third or even more values. When you design APIs that thousands of people use, you tend to hedge your bets this way to avoid releasing new, potentially confusing and controversial overloads. But it looks like msoTriState should've been at least three separate enumerations rather than this one overused enumeration with private implementation details.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Sep 18th, 2015, 07:46 PM
#6
Frenzied Member
Re: MSDN: A tri-value boolean, which can have five values, but only two are supported
Originally Posted by dilettante
Excellent point regarding Null in DBMS fields.
Yes we also have nullable? boolean in .NET
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|