Re:Type Theory and Functional Programming (1999) [pdf]
by zozbot234 on Wednesday October 01, 2025 @08:29AM
(#45436888)
These so-called dynamic types are merely the equivalent of tags in a discriminated union/variant type. Statically-typed languages can easily do the same thing: the argument that this amounts to "building an interpreter" applies to any language implementation.
[ Parent
| on HN ]
Re:Type Theory and Functional Programming (1999) [pdf]
by remexre on Wednesday October 01, 2025 @08:55AM
(#45437119)
> These so-called dynamic types are merely the equivalent of tags in a discriminated union/variant type.
That's far more true in a language like JavaScript or Scheme than in an "everything is an object" language like Python; the only reason why you would need a variant type for PyObject is to avoid the circular data structures the actual implementation uses.
If you allow the circular data structures, your dynamic types instead are "merely" a relatively complicated codata type, but it's far less obvious that this is actually what anyone considers to be "merely."