Hacker News new | ask | show | jobs
by timzaman 1880 days ago
"triple state boolean", what's next, a double precision fp32?
3 comments

Also known as *bool, "Maybe Bool", "Boolean?", "Optional<Boolean>" etc.
Well, in browsers there's `HTMLMediaElement.canPlayType()` which returns one of the following strings:

- "probably"

- "maybe"

- ""

Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaEl...

My goodness. I remember having to explain this to my manager. They really wanted recording + playback in our platform. For as many browsers as possible. Even mobile (iOS, I'm looking daggers at you). In 2015.

AFAIR I just said fuck it and made playback as permissive as possible (i.e., only prevent media playback if canPlayType returned ""). I don't know how advisable that is but the bug got off my back anyway.

I dunno what makes this so difficult, why we can't get at least a definite "yes" even in 2021.

That's like my washing machine which has a Normal setting, a Standard setting, a Wash setting...
Do you mean as in "If the washing machine has a Wash setting, what does it do if it is not set to Wash?"
And what's the difference between normal and standard?
Wat
yeah, but if you really need to store 3 states, why not make 1 first-class concept instead of awkwardly combining two?
Because a nullable bool has literally the same semantics as Maybe<Bool>. Why invent it again but in your app this time?
Long Boolean! Yes, no, don’t know, weekdays only.
If boolean comes from George Boole, then maybe we should call triple state values "Łukasiewiczan", it would make for a funny typing exercise :P https://en.wikipedia.org/wiki/Jan_%C5%81ukasiewicz