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,以及(三) 一种单一式语言,通过实施典型的工会-缩写、精确地重新构建这些格式的交叉类型,作为这些格式的缩写形式。