In this essay, I present the advantages and, I dare say, the beauty of programming in a language with set-theoretic types, that is, types that include union, intersection, and negation type connectives. I show by several examples how set-theoretic types are necessary to type some common programming patterns, but also how they play a key role in typing several language constructs-from branching and pattern matching to function overloading and type-cases-very precisely. I start by presenting the theory of types known as semantic subtyping and extend it to include polymorphic types. Next, I discuss the design of languages that use these types. I start by defining a theoretical framework that covers all the examples given in the first part of the presentation. Since the system of the framework cannot be effectively implemented, I then describe three effective restrictions of this system: (i) a polymorphic language with explicitly-typed functions, (ii) an implicitly-typed polymorphic language \`a la Hindley-Milner, and (iii) a monomorphic language that, by implementing classic union-elimination, precisely reconstructs intersection types for functions and implements a very general form of occurrence typing. I conclude the presentation with a short overview of other aspects of these languages, such as pattern matching, gradual typing, and denotational semantics.
翻译:在本论文中,我介绍用设定理论类型,即包括组合、交叉和否定类型连接等类型的语言编程的优点,我敢说,用设定理论类型,用设定理论类型,用设定理论类型来键入一些共同的编程模式。我通过几个例子展示了设置理论类型对于键入某些共同编程模式的必要性,同时也展示了它们如何在从分支和模式中键入几种语言构造与功能超载和类型-非常精确地匹配方面发挥关键作用。我首先介绍了被称为语义缩略缩缩缩略语的理论,并将其扩展至多形态类型。接着,我讨论了使用这些类型的语言的设计。我首先界定了一个理论框架,涵盖介绍第一部分中列举的所有实例。由于框架体系无法有效实施,我然后描述了这一体系的三个有效限制:(一) 一种具有明确类型功能的多形态语言,(二) 一种隐含型的多形态语言 ⁇ a la Hindley-Milner, 以及(三) 一种单一形态语言,通过实施典型的工会-缩略缩略概览,精确地重建了这些格式的交叉类型功能和格式的其他格式。