Path: utzoo!attcan!uunet!mcsun!unido!opal!wg From: wg@opal.cs.tu-berlin.de (Wolfgang Grieskamp) Newsgroups: comp.lang.functional Subject: Re: A question about types in ML Message-ID: <2241@opal.cs.tu-berlin.de> Date: 19 Nov 90 01:03:47 GMT References: <4906@rex.cs.tulane.edu> <2215@opal.cs.tu-berlin.de> <4971@rex.cs.tulane.edu> <11901@life.ai.mit.edu> <2236@opal.cs.tu-berlin.de> Sender: news@opal.cs.tu-berlin.de Reply-To: wg@opal.cs.tu-berlin.de Followup-To: comp.lang.functional Distribution: comp Organization: Technical University of Berlin Lines: 37 Nntp-Posting-Host: troll.cs.tu-berlin.de wg@opal.cs.tu-berlin.de (Wolfgang Grieskamp) writes: >peterson-john@cs.yale.edu (John C. Peterson) writes: > >Regarding typing in Common Lisp & ML, it is incorrect to say that > >Common Lisp lacks types; type declarations in CL are actually far more > >general than those in ML. What Common Lisp lacks is any sort of well > >defined type inference, a major deficiency. >As i remember from a short afair with LISP some years ago, type >declarations in CL are always monomorphic: no parametric >polymorphy, no type variables. Oh sorry, someone inspired me meanwhile to remember how it works in CS: its actually much more general then even, say, dependent types. Its based roughly on the general program transformation scheme (excuse LISP style errors): (def f '((T1 x1) ... (Tn xn)) E) => (def f '(x1 ... xn) '(if (and (T1 x1) ... (Tn xn)) E '(halt))) ... where Ti's are user defined predicates (checking types) or primitives for the predefined types. Now, the compiler can use abstract interpretation or other techniques to analysis preconditions Ti and actual arguments to applications of f (if he knows its an application) and generate type errors. This is a bit hard sometimes, but will often work for predefined types like bool, int, etc. - at least with the whole program under analysis. Hope i understood the "typing" discipline in Common LISP correct know (the LISP experts brought up typing and LISP should correct me otherwise). -- Wolfgang Grieskamp wg@opal.cs.tu-berlin.de tub!tubopal!wg wg%opal@DB0TUI11.BITNET