Haskell的忽略对象系统
Haskell's overlooked object system
摘要:
Haskell提供了类型类绑定和参数多态性,而不是Java和OCaml等面向对象语言的子类型多态性。Haskell 98不带扩展、带普通扩展或带新扩展是否能完全支持传统的面向对象程序设计,包括封装、可变状态、继承、重写、静态检查、隐式和显式子类型等,这是一个有争议的问题。包括第一级词法作用域类、隐式多态类、灵活的多重继承、安全向下转换和安全协变参数。Haskell确实可以支持宽度和深度,结构和名义子类型。我们解决了保持Haskell的类型推断的特殊挑战,即使是对象和对象操作函数。面向对象特性在Haskell中作为OOHaskell库引入。OOHaskell适合作为类型化OO语言设计的沙箱。
英文摘要:
Haskell provides type-class-bounded and parametric polymorphism as opposed to subtype polymorphism of object-oriented languages such as Java and OCaml. It is a contentious question whether Haskell 98 without extensions, or with common extensions, or with new extensions can fully support conventional object-oriented programming with encapsulation, mutable state, inheritance, overriding, statically checked implicit and explicit subtyping, and so on. We systematically substantiate that Haskell 98, with some common extensions, supports all the conventional OO features plus more advanced ones, including first-class lexically scoped classes, implicitly polymorphic classes, flexible multiple inheritance, safe downcasts and safe co-variant arguments. Haskell indeed can support width and depth, structural and nominal subtyping. We address the particular challenge to preserve Haskell's type inference even for objects and object-operating functions. The OO features are introduced in Haskell as the OOHaskell library. OOHaskell lends itself as a sandbox for typed OO language design.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。