Scala's type system is primarily based on nominal typing. Scala 3 introduces a special type, Selectable, which provides an infrastructure for structural typing. Karlsson and Haller proposed improvements to Selectable to support extensible records. In this paper, we review several Scala 3 projects that involve structural typing. We find that their implementation or usability would benefit from the extensible records proposal from Karlsson and Haller. We investigate the remaining common challenges when working with structural types. In particular, we identify that a dedicated syntax for both record types and record literals would be the most beneficial addition to the language.
翻译:Scala 的类型系统主要基于名义类型。Scala 3 引入了一种特殊类型 Selectable,为结构类型提供了基础设施。Karlsson 和 Haller 提出了对 Selectable 的改进方案,以支持可扩展记录。本文回顾了多个涉及结构类型的 Scala 3 项目。我们发现,这些项目的实现或可用性可以从 Karlsson 与 Haller 提出的可扩展记录方案中获益。我们进一步研究了处理结构类型时存在的共性问题,并特别指出,为记录类型和记录字面量添加专用语法将是该语言最有益的增强。