Pre SIP: Named tuples

Another way to consider this (which is almost done here) is to consider “named type” as a variety of type. For example, foo: String is itself a type, which is a subtype of String. Viewed this way, a named tuple is just an ordinary tuple with specific types (and one could even mix named and non-named types in a tuple). It would also mirror FieldType in shapeless really well and put a nice bow on the isomorphism between case classes and records, and would be cleaner to deal with in macros than the tuple-of-tuples.

But, however it’s accomplished, I like the idea of tuples with compile-time names.

Edit: By “almost done here” I mean that “NameAndType” is introduced in the syntax, but isn’t given a correspondent in the type system.

3 Likes