Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!uupsi!sunic!kuling!kuling.docs.uu.se!mattias From: mattias@sylvester.csd.uu.se (Mattias Waldau) Newsgroups: comp.lang.prolog Subject: Re: A Type checking/reconstruction procedure for Typed-Prolog Message-ID: Date: 1 Mar 91 06:03:21 GMT References: <1991Feb25.180837.24161@m.cs.uiuc.edu> Sender: news@kuling.UUCP Organization: Computing Science Dept, Uppsala University, Sweden Lines: 88 In-reply-to: lakshman@n.cs.uiuc.edu's message of 25 Feb 91 18:08:37 GMT To: lakshman@n.cs.uiuc.edu (T.K. Lakshman) In-reply-to: lakshman@n.cs.uiuc.edu's message of 25 Feb 91 18:08:37 GMT Subject: A Type checking/reconstruction procedure for Typed-Prolog BCC: mattias --text follows this line-- I like the type checker very much, it works fine under sicstus 0.7, except that in the typechecker tries to redefine numbervars (are there actually DEC-10 like prologs without numbervars?). Thanks for posting a nice program! /mattias Two warnings to other users: 1) the program cannot handle disjunctions (anoying, but simple to fix, just expand the disjunction to a set of clauses) 2) the program cannot distinguish between different predicates with the same functor but different arity, e.g. foo/3 and foo/5. Rename foo/5 to foo_aux/5. Two suggestions/questions to the authors: 1) please redefine rload, so that it accepts a list of files, and rewrite libdecls to fit your format (i.e. remove :- from the file). then we can typecheck a set set of files, first loading libdecls, by writing [libdelcs, file1, file2]. It doesn't bother me if all output is put in the same file. 2) Funny (erroneous) behaviour: the program type bar --> a ; b. type foo --> b ; c. p(b). results in % Type Constructors : type bar(0). type foo(0). % Types for Functions : type a: [] --> bar. type b: [] --> bar. type b: [] --> foo. type c: [] --> foo. % Types for Predicates : pred p(bar). % Program : p(b). but the program type bar --> a ; b. type foo --> b ; c. p(b). p(c). results in an error ...Reading declarations and program clauses ... doing Type Checking / Reconstruction @#$%^&>> Type Conflict in types fun([],foo) and fun(_2470,bar) { Execution aborted } | ?- What behaviour is correct, both since the type declaration is incorrect. The constant "b" occurs in several types. -- Mattias Waldau Computing Science Department mattias@emil.csd.uu.se P.O. Box 520, S-751 20 Uppsala, Sweden Phone: +46-18-181055