This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||
|
Overview
editThe purpose of bounded quantification is to allow for polymorphic functions to depend on some specific behaviour of objects instead of type inheritance. It assumes a record-based model for object classes, where every class member is a record element and all class members are named functions. Object attributes are represented as functions that take no argument and return an object. The specific behaviour is then some function name along with the types of the arguments and the return type. Bounded quantification allows to considers all objects with such a function. An example would be a polymorphic min function that considers all objects that are comparable to each other.
This description doesn't sound at all like bounded quantification to me, it sounds like duck typing, structural typing or typeclasses. I also don't understand the relevance of the middle bit about a record-based model, but it seems to be describing a very specific implementation (possibly of typeclasses?) that I doubt applies universally to bounded quantification.ディーエッフ (talk) 13:14, 23 November 2022 (UTC)
Example
editI don't think the example makes sense. Shouldn't it rather be min: ∀ T. {compareTo: T → int} → T → ?, that is to say, we don't really know how to type this without F-bounded quantification? Isn't this the very point of introducing F-bounded quantification, i.e., that we can't type the program without it? The erased Comparable interface is just an unsafe escape hatch. Maybe an example based on Cloneable<T> is more intuitive? Sgraf812 (talk) 08:18, 25 June 2019 (UTC)sgraf812