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 IAA13696; Sun, 8 Jun 2003 08:32:45 +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 IAA13481 for ; Sun, 8 Jun 2003 08:32:43 +0200 (MET DST) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h586WgH19120 for ; Sun, 8 Jun 2003 08:32:42 +0200 (MET DST) Received: (qmail 6573 invoked from network); 8 Jun 2003 06:32:41 -0000 Received: from unknown (HELO grace.speakeasy.org) ([216.254.0.2]) (envelope-sender ) by mail16.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 8 Jun 2003 06:32:41 -0000 Date: Sat, 7 Jun 2003 23:32:41 -0700 (PDT) From: brogoff@speakeasy.net To: "Jun.Furuse@inria.fr" cc: Pierre Weis , Oleg Trott , John Max Skaller , "caml-list@inria.fr" Subject: Re: easy print and read (was: [Caml-list] Why are arithmetic functions not polymorph?) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam: no; 0.00; brogoff:01 caml-list:01 furuse:01 generic:01 g'caml:01 inferred:01 hacks:01 checker:01 inefficient:01 speakeasy:01 arithmetic:01 restrict:02 float:02 typing:03 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 7 Jun 2003, Jun.Furuse@inria.fr wrote: > Yes, in this case, it is easy to tell that there is only one > applicable typing for plus one two, that is plus : float -> float -> float. > But in general, nubmer of type case combinations may increase quite > easily and searching applicable typing from them becomes quite inefficient. > Moreover, when we have recursive generic values, the search space may > be infinite! Therefore, we must restrict the search space of type case > combinations in some manner (otherwise, typing may never terminates). > > The restriciton in the G'Caml implementation is quite simple, > therefore you may feel some inconvenience: the type of plus one two > is not inferred automatically, for example. Hi, I understand the pragmatics. If it turns out that this is painful in practice for cases like linear algebra or numerics libraries where the generic values are not recursive, I hope that a less restrictive rule can be adopted. I don't think that the hacks used by other languages which have types which throw the type checker into a loop (setting some iteration limit) are so bad, and I think they can be applied here. Right now we don't have any significant practice to go on, so I think the conservative rule is OK, since, as you point out, it is simple. It's a bit weird that the example I posted works if the order is switched in the declaration of "plus". -- Brian ------------------- 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