全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Type variable, type scheme, parametric polymorphism?

又称: type variable · type scheme · parametric polymorphism · let-polymorphism

Definition 6.10 University Computer Science — Year 3 · 第 6 章 — Type Systems and Type Inference

A type variable α\alpha stands for an unknown type; we print them 'a, 'b, …. A type scheme ∀α1…αn. τ\forall \alpha_1 \dots \alpha_n.\,\tau is a type with some of its variables quantified: it stands for every type obtained by replacing them, its instances. A function is parametrically polymorphic if it has a type scheme, one code for all the instances. Let-polymorphism gives schemes to variables bound by let, and only types to variables bound by λ\lambda.

在原文中阅读 →