In this paper, we describe our experience incorporating gradual types in a statically typed functional language with Hindley-Milner style type inference. Where most gradually typed systems aim to improve static checking in a dynamically typed language, we approach it from the opposite perspective and promote dynamic checking in a statically typed language. Our approach provides a glimpse into how languages like SML and OCaml might handle gradual typing. We discuss our implementation and challenges faced -- specifically how gradual typing rules apply to our representation of composite and recursive types. We review the various implementations that add dynamic typing to a statically typed language in order to highlight the different ways of mixing static and dynamic typing and examine possible inspirations while maintaining the gradual nature of our type system. This paper also discusses our motivation for adding gradual types to our language, and the practical benefits of doing so in our industrial setting.
翻译:在本文中,我们用Hindley-Milner风格类型的推理来描述我们将渐进式功能语言纳入静态键入式功能语言的经验。 在大多数渐进式系统旨在改善动态键入语言静态检查的情况下,我们从相反的角度对待它,用静态键入语言促进动态检查。我们的方法为我们如何用SML和OCaml等语言逐步打字提供了一瞥。我们讨论了我们的执行情况和面临的挑战 -- -- 具体地说,渐进式打字规则如何适用于我们混合型和循环型语言的表述。我们审查了在静态键入语言中添加动态打字的各种实施方法,以突出混合静态和动态打字的不同方式,并检查可能的灵感,同时保持我们类型系统的渐进性质。本文还讨论了我们增加我们语言渐进型的动机,以及我们工业环境中这样做的实际好处。