Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Type variable, type scheme, parametric polymorphism?

Dikenal juga sebagai: type variable · type scheme · parametric polymorphism · let-polymorphism

Definition 6.10 University Computer Science — Year 3 · Bab 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.

Baca dalam konteks →