Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ummm... devrant?
the trailing underscore was part of that url... it doesn't work without it... -
In electrical circuits there are tri-states for digital logic. It can be on, off, or tri-state (not driven or floating). This allows for other logic to drive the lines. It has also been used in addressing chips so you can address 8 devices with 2 lines. I am sure there are other uses. Is it a boolean, or something else?
-
If in your language types are nullable by default, your booleans are tristate by default...
-
@Oktokolo i'm actually still thinking whether to have null or not.
currently leaning towards "yes, but that null also has a native behavior same as the null object pattern" -
@Demolishun off is the same as not driven, floating or high impedance, on means low impedance, either high or low driven. Don't use on and off for high and low driven, this is confusing.
-
@Midnight-shcode
You don't want to have null as possible "value" of any base type.
But sometimes, some value can semantically be unknown or not applicable instead of an actual value.
And then you can type the variable as Optional<baseType>, Union[baseType, null], Nullable<baseType> or just baseType? depending on how limited your language's type system is.
If you are using Java, you are basically fucked, because everything is a union with null there.
C# and TypeScript both inherited that fuckery, but got a flag for turning on null-safety by default (still no proper unions in C# though).
And if you are designing a logic circuit emulator, your IoPinState type actually should have the three possible values and could additionally be optional/nullable in code where the state may be unknown...
Related Rants
I have just been made aware that not everyone in this community knows the legendary tri-state boolean.
It is impermissible for anyone in this community to not know of the legendary tri-state boolean.
https://thedailywtf.com/articles/..._
joke/meme
you're welcome