This paper defines an extended polymorphic type syste for an ML-style programming language,and develops a sound and omplete tyep inference algorithm.Different from ther conventional ML tyep disciline,the proposed type system allows full rank 1 polymorphism,where polymorphic types can appear in other types such as product tyeps,disjoint union types adn range tyeps of function types.Beacuse of this feature,the propsoed type system significantly reduces the value-only restriction of polymorphism,which is currently adopted in most of ML-style impure languages.It also serves as a basis for efficient implementation of type-directed compilation of polymorphismThe extended type system achieves more efficient tyep inference algorihtm,and it also contributes to develop more efficient type-passing implementation of polymoprhism.We show that the ocnventional ML polymorphism sometimes introduces exponential overshead both at compile-tiem elaboratin and run-time type-passing exectution,and that these problems cna be eliminated by our type inference system.Compared with a more powerful rank 2 tyupe inferene systems based on semi-unification,the proposed type inference algorithm infers a most general type for any typeble expression by using the conventional first-order unification,and it sis therefore easily adopted in existing implementation of ML family of languages.
展开▼