> MsoTrioState is "a tri-state Boolean value". it has five possible values. only two of them are supported.
*) https://learn.microsoft.com/en-au/dotnet/api/microsoft.offic...
Sourced from here https://fedi.lynnesbian.space/@lynnesbian/115969259564305759
So let's remember: some programmer, somewhere, is right now thinking about building a tri-state boolean because they think it fits their current problem perfectly fine. And they are always wrong.
It is a specific optimization based on the idea of storing one type inside of another type by finding a "niche" of unused bit pattern(s) inside the second type.
It has far more useful application than a tower of Option 254 deep.
Ah how many of those options fit into that boolean. Word games!
You can make them smaller using bitfields in C.
Even now, I still find myself using true/false/null on occasions, but I'm usually smart enough to replace it with an enum at that point. The only time I don't is when it's an optional parameter to a function to override some default/existing value, at which point it then makes sense to keep it as an optional bool.
sizeof(struct {bool a:1;}) == sizeof(char);Option<NonZeroU32> seems like a much more reasonable to justify this with. Also, enums can easily have invalid bit patterns that are unused without there being any specific bit that is always available. All you need is a single variant of the enum to have a free bit, and you have a niche to shove None into.
If one Boolean must be a byte then 8 must be eight bytes. Which is not true. A boolean can be 1/8th of a byte which is a meaningful distinction.
For some vector logic the distinction could matter.
public static void main (String[] args) {
Optional<Boolean> n = Optional.ofNullable(null);
Optional<Boolean> e = Optional.empty();
System.out.println(n.equals(e));
}
true
https://ideone.com/EGRdi5A null in an Optional is empty. So you've got:
Optional<Boolean> n = null;
Optional<Boolean> e = Optional.empty();
Optional<Boolean> t = Optional.of(Boolean.TRUE);
Optional<Boolean> f = Optional.of(Boolean.FALSE);For more common situations where the yes/no bool is not available yet or should not be considered, constructs like Rust’s Option<bool> are a very good fit. Layering the bool inside of an Option creates intentional handling about the presence or lack of value first before you can work with it.

A lot of them, apparently.
Toggle original/dithered image
Hello!
Not too long ago, a friend of mine told me about Paged Out!, a “free experimental (one article == one page) technical magazine”. (Yes, that means that you can read them online right now. In fact, you might even want to consider contributing).
I thought “Huh, that’s cool.” and then neglected to follow up on it in any meaningful capacity whatsoever, since it’s notoriously hard to remember to sit down and look at a random tab in your browser, especially if it is slowly being buried beneath other tabs.
About halfway through August I suddenly received an e-mail by someone named Aga, asking me if I’m interested in contributing a one-page article to this funny magazine thing they are running.
I was like “Huh, that’s cool… Wait, I’ve heard of this. Screw it, why not.” and hammered out an article over two evenings, combining my knowledge of random Rust trivia with the full power of the modern tech infrastructure stack (which is to say, Google Slides1) to create a funny little one pager:
/ [pdf]
A few notes:
Result<bool, bool> takes up more than one byte. Someone on Reddit let me know why. In hindsight this one feels obvious, but (in the spirit of the challenge) I didn’t want to get sucked into research over what I assumed to be an optimization detail. It turns out it isn’t: It’s just that (duh) the value in the result has to have a valid memory representation, so we can’t use the remaining bits to optimize.size_of::<type>() syntax. This looks weird at first, but makes perfect sense. The ’turbofish’ syntax (::<T>) allows us to specify the type passed to a generic function without needing to pass a value. It’s just a function (albeit one backed by a compiler built-in). In C/C++ sizeof requires a special keyword.If you don’t care about what’s going on in my life, you can leave now! This is just a few notes about what I have been up to.
tl;dr: It looks like I’ll be moving from Central Europe (working on AI) to the Seattle area (working on AI, very funny, I know).
This is objectively one of the funnier times to do that. So far I’ve not regretted decisions like this, and I hope that that pattern continues. (2+ years ago I moved from Germany to Warsaw. Warsaw is nice. The local language barrier is a drawback, though.)
As for Seattle, I am looking forward to it. I know people there. I visted a few months ago. I liked the local scene. I liked the random encounters you’ll get around Cal Anderson. I liked the $1.50 Costco hotdog. I liked the drinks served at the local furry-owned cider company. I liked the events, whether it’s local fighting game tournaments, literal Labubu raves, or random people meeting in the middle of the park to ’eat pudding with forks'.
I’ll find out. It helps that I know a surprising amount of people in the area.
As far as writing goes, I have a whole bunch of half-finished drafts that I’ll surely get around to one of these days.
There’s a lot of random things on my mind: Hot takes about memory safety, thoughts on software licensing, AI, and social contracts, thoughts on GAP, random takes on obscure video games I enjoyed, LLVM, whatever Uiua is.
Maybe I’ll finish some of those and put them here.
I don’t want to stress out too much over it, honestly. A blog is something you do for yourself, stressing out too much over it is a bad idea. I have a backlog, and that’s fine. That’s a list of potential fun projects I can pick up and work on whenever I feel like it.
Besides, If I can’t figure out how to put something into words, that’s generally a good sign that I need to take a step back and let it rest for a while (or that I need to spent some time on more in-depth research).
Anyway, have a good one!