The term really refers to the technique of having a fattier, βLego brickβ structure at the core of a system, and thus relaxing static type checking (within that system). As such, you increase bang-for-buck of codepaths, increase dynamic runtime capabilities, and so on.
25.07.2025 05:08 β π 1 π 0 π¬ 0 π 0
βFat structβ does not imply a βtypeβ or βkindβ field. They can contain them, but the main part is unlike discriminated unions, they have nothing to do with the data layout.
25.07.2025 05:08 β π 1 π 0 π¬ 1 π 0
Alas, extragate behavior
10.12.2024 14:46 β π 0 π 0 π¬ 1 π 0
Oh noβ¦ direct confrontation?! Heβs coming to explain his point?! I was just planning on disparaging his reputation from a distanceβ¦ Thatβs what social media is for, after allβ¦
10.12.2024 14:04 β π 1 π 0 π¬ 2 π 0
UI, Part 3: The Widget Building Language
Details on what I've learned about building an adequate core widget hierarchy construction API.
I just call it βfat structβ, βmega structβ, or βlego brickβ. An important part is that the flags donβt signify the presence of data, they just control which codepaths apply.
I wrote a post about this in the context of UI programming: www.rfleury.com/p/ui-part-3-...
10.12.2024 13:51 β π 1 π 0 π¬ 1 π 0
bsky.app/profile/rfle...
10.12.2024 13:38 β π 0 π 0 π¬ 0 π 0
Yes, and furthermore, the degree to which variants are different is often exaggerated unnecessarily by the programmer. You have some degree of control over the overlap. But if they are that different, itβs possible they shouldnβt even be in the same type at all.
10.12.2024 13:37 β π 0 π 0 π¬ 0 π 0
This makes the serialization code easier to table-drive, generate, and it just makes it smaller & more static; using the type for a new case doesnβt require all sum-type usage sites to update accordingly.
10.12.2024 13:28 β π 0 π 0 π¬ 0 π 0
Imagine, for example, serializing a type, so I can send it over the network. If itβs a fairly complex sum type, that sum type structure needs to mirror itself in the serialization code. If itβs a simpler product type package, the serialization code is flat.
10.12.2024 13:28 β π 1 π 0 π¬ 1 π 0
Not always. You *can* have a tag, but in many cases, the more useful construct is flags, which signal an instanceβs applicability to a given codepath. You can also store a tag, and have a tag -> flags table. But many codepaths simply donβt want to check.
10.12.2024 13:26 β π 0 π 0 π¬ 2 π 0
Anyways, wouldβve been nice if you left it at βI donβt know what he meansβ, rather than just jumping to explaining my point for me, with the most caricatured & laziest interpretation, for a quick dunk.
10.12.2024 13:23 β π 0 π 0 π¬ 0 π 1
This was interleaved with dunking on my βpointersβ point, and the idea there was basically you donβt need to assume that pointers can be null at any time, if you are working in a sane architecture, where e.g. memory is preallocated, nil structs are used to make all reads safe, and so on.
10.12.2024 13:18 β π 0 π 0 π¬ 3 π 0
This doesnβt sacrifice type safety, it just doesnβt apply it to the Nth degree. Sometimes you want to relax typechecking in favor of dynamic flexibility & composability. At the boundary of that space, it is obviously still typechecked.
10.12.2024 13:11 β π 0 π 0 π¬ 1 π 0
Another way of saying this is that the structure of code is a function of the structure of types. Do you want your code to be mostly flat, work in large batches, with as-simple-as-possible data transform requirements, derived from what the computer needs to do? Okay, design the types to match.
10.12.2024 13:08 β π 1 π 0 π¬ 1 π 0
No, I am including tagged unions in that definition, actually; nobody here is actually investigating my point with any degree of depth.
10.12.2024 13:06 β π 0 π 0 π¬ 0 π 0
For anyone wanting to treat the subject in good faith: bsky.app/profile/rfle...
10.12.2024 13:04 β π 1 π 0 π¬ 1 π 0
This is not always the right decision, but often can be, because it deduplicates codepaths & allows them to apply to a larger set of data, thus increasing their utility.
10.12.2024 13:04 β π 0 π 0 π¬ 1 π 0
This often results in designs which collapse multiple variants of a sum type into a single product type. This eliminates typechecking between those variants, effectively forming a βdynamically typed spaceβ for them.
10.12.2024 13:04 β π 0 π 0 π¬ 3 π 0
In my experience it has been much better to think carefully about data transform requirements of my program, and design batch workloads that operate on a set of simple homogeneous (product) types, and have everything flow that way.
10.12.2024 12:59 β π 1 π 0 π¬ 1 π 0
No, that isnβt what Iβm arguing. Iβm saying heterogeneous types require heterogeneous codepaths. Sum types require interleaving heterogeneous work at all usage sites of the type, which is often a bad decision for both simplicity & performance.
10.12.2024 12:59 β π 0 π 0 π¬ 4 π 1