grumpyprole 3 hours ago

Most languages have poor support for structural types though. If you try and join two records together (like a SQL join), what will your favourite language infer then?

  • sfn42 2 hours ago

    C# has anonymous types which is pretty much the same thing. Though I prefer to declare actual types for most usecases, I'll only use anonymous types for intermediate results and such.

    • grumpyprole 2 hours ago

      I certainly don't mean to knock nominal types. But I think structural types are more fundamental. A language would only need a single "newtype" or "nominal" keyword to create nominal types from structural types.

sheept 3 hours ago

dictionaries generally aren't guaranteed to contain an entry for every possible value of the key type. while you could implement the colors example with a dictionary, ideally you'd want the type system to assure that given a Color, there will be a string associated with it

fuzzy2 3 hours ago

It's not a dictionary (type-wise). "as const" is the magic ingredient.