Hot take frinklang.org is one of the most interesting demonstrations of "real world" dynamic types as something beyond just "not static types". I don't see how its unit affordances would be feasible without runtime type manipulation.
Conversation
One example: if you define a new unit "duck", Frink immediately understands what a "kiloduck" is. It knows how the kilo- prefix works with any unit.
7
1
12
Curious to know why this is dynamic vs. static type thing. It's certainly seems to be either an argument against extensible type systems, or an argument for domain-specific static type systems, or for a blending between the static and dynamic (I like the last one).
1
I've found this big survey of stuff related to units of measure handy in the past: gmpreussner.com/research/dimen - covers a huge range of stuff from the static to the dynamic. You may have seen it before though.
2
1
9
The main weakness of that survey is that it doesn't distinguish between languages that can manipulate and query units at runtime (e.g. Frink) and those which have all units erased at compile time (e.g. F#).
1
2
Being able to manipulate/check/query units of measure at runtime is critical any time you handle input from users or files.
2
3
Yeah, that's a pretty reasonable critique! Doing this in a type-checked way seems to imply you'd need some sort of full spectrum dependent types. I'm guessing that the dynamic approach could make this easier on the implementer and the user?
Representing units of measure is very simple at runtime. Here's a slide from a presentation I gave at MIT which is somewhat old but mostly valid. (Units of measure can now have rational number exponents in Frink.)
frinklang.org/LL4.html#slide


