From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA08769; Mon, 3 Jun 2002 19:07:23 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA08764 for ; Mon, 3 Jun 2002 19:07:22 +0200 (MET DST) Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.25.148.40]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g53H7JP20985; Mon, 3 Jun 2002 19:07:20 +0200 (MET DST) Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id g53H7HZr027149; Tue, 4 Jun 2002 03:07:17 +1000 (EST) Received: from ozemail.com.au (ppp70.dyn17.pacific.net.au [61.8.17.70]) by wisma.pacific.net.au with ESMTP id DAA17550; Tue, 4 Jun 2002 03:07:15 +1000 (EST) Message-ID: <3CFBA242.1030900@ozemail.com.au> Date: Tue, 04 Jun 2002 03:07:14 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: Francois.Pottier@inria.fr CC: caml-list@inria.fr Subject: Re: [Caml-list] Hashtbl iter semantics References: <200205271904.VAA0000015105@beaune.inria.fr> <3CF5258C.3080409@ozemail.com.au> <20020530085315.A24997@pauillac.inria.fr> <3CF7B2E7.2030408@ozemail.com.au> <20020603090337.A16935@pauillac.inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Francois Pottier wrote: >but the usual way to perform unification >in the presence of cyclic (equi-recursive) terms is to physically unify two >nodes *before* looking at their sub-terms (instead of *after*, or not at all, >in the non-cyclic case). This way, if you run into a cycle and you end up >attempting to unify the same two nodes, you will succeed immediately, provided >your first step is to check for physical equality. I can provide some sample >code if that helps. > Should be ok: that's what Cardelli's comparison does (which I have implemented). > >That said, type inference in the presence of equi-recursive types is considered >difficult for the user to figure out... many intuitively `meaningless' programs >admit (weird) recursive types. > Sure, but I'm not doing "type inference", but "type deduction". The types of function arguments *must* be declared. Felix deduces the type of expressions, and thus variables, and also function return types (in most cases :-)) I chose that strategy for two reasons: (1) full scale type inference is difficult to implement, difficult to understand, and very difficult to give good error messages. (2) Felix supports overloading. If type inference with overloading is tractible, it is surely even more difficult to implement and understand. The current rule for generic functions is that type arguments must be explicitly given. (I hope to relax that later ..) Actually, I uave two kinds of type variables; 1) initially unknown function return types 2) variables in generics The first kind aren't 'variable' (they have single type, it just isn't known yet). The second kind are just parameters which have to be explicitly bound to types by the client. So the scope of the 'unification' algorithm is (1) deducing function return types, and (2) comparing two generic types to see if one matches the other. (1) is implemented, but the algorithm is very unsatisfying. The problem is that during deduction it is necessary to perform overload resoliution: I can't handle partial matching here, so all the type variables have to be eliminated at that point. -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners