Path: utzoo!attcan!uunet!samsung!rex!caesar!fs From: fs@caesar.cs.tulane.edu (Frank Silbermann) Newsgroups: comp.lang.functional Subject: Re: A question about types in ML Message-ID: <4906@rex.cs.tulane.edu> Date: 12 Nov 90 15:33:19 GMT References: Sender: news@rex.cs.tulane.edu Distribution: comp Organization: Computer Science Dept., Tulane Univ., New Orleans, LA Lines: 38 >In paula@SHUM.HUJI.AC.IL (Paula Ross) writes: >> Is there any way in ML that you can create a data type >> which accepts sequences of objects of different types >> (when the number and types of the objects are not known >> in advance) ? i.e. can you create a list type without >> the restriction that each element of the list must be >> of the same type ? In article fraser@bilby.cs.uwa.oz.au (Fraser Wilson) writes: > As far as I know you can only do this using a union type, > which means you have to know what types you will get. > I don't think it can be done for an arbitary type. One might seek to create a union type which contains within it _all_ possible types (i.e. as the solution to a recursive type equation). Unfortunately this violates the requirement that all type signatures be finite constructions from the primitive types. The problem is that typechecking (and type inference) in the typed lambda calculus is not generally decidable. To make typechecking decidable, we impose a restriction on type signatures, such as the one above. Because such restrictions handcuff the programmer, one line of reseach seeks to develop restrictions for decidablilty which maximize polymorphism. Because compromise between flexibility and safety will always involve a trade-off, I believe that untyped functional languages (e.g. those in the LISP/Scheme style) will never become completely obsolete. Frank Silbermann fs@cs.tulane.edu Tulane University New Orleans, Louisianna USA