New Bob Nystrom blog post! Always going to upvote that.<p>More substantially, I was thinking of Typescript's control flow analysis as soon as I started reading through the "Record cases" section, I was already thinking of commenting on it, and then the next section anticipated my thoughts. I can definitely understand that being difficult to implement in the general case, but I'm curious if it'd be workable within the context of a single statement/expression. I'm envisioning something like Go's .(type) syntax. You'd probably need to restrict what would be allowed within each case branch, though, and that could get tricky and unintuitive to use.
His solution and syntax remind me of Ada's variant records. Despite Ada's focus on safety, it also resorts to runtime exceptions for incompatible fields in that case. That's probably a local maximum in the language design space.
> imagine you have a record for storing a street address<p>In my experience these are all strings. Try storing a UK postcode as an int or a value like "1B" in an apartment number.