Representing Heterogeneous Data
journal.stuffwithstuff.com
Representing Heterogeneous Data
1–5 of 5 posts
Re: Representing Heterogeneous Data
#2In my experience these are all strings. Try storing a UK postcode as an int or a value like "1B" in an apartment number.
Re: Representing Heterogeneous Data
#3More 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.
Re: Representing Heterogeneous Data
#4Re: Representing Heterogeneous Data
#5His 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.