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 TAA01333; Sun, 9 Jun 2002 19:30:00 +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 TAA01296 for ; Sun, 9 Jun 2002 19:29:59 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g59HTwH11391; Sun, 9 Jun 2002 19:29:58 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA01309; Sun, 9 Jun 2002 19:29:58 +0200 (MET DST) From: Pierre Weis Message-Id: <200206091729.TAA01309@pauillac.inria.fr> Subject: Re: [Caml-list] Comments on type variables In-Reply-To: from Alain Frisch at "Jun 6, 102 07:04:48 pm" To: frisch@clipper.ens.fr (Alain Frisch) Date: Sun, 9 Jun 2002 19:29:58 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Alain, There already had been a long thread on the subject in this list. You are right and I guess all the implemnetors aggree with you : therés a problem with type constraints. [...] > A paragraph in the FAQ is somewhat misleading: > > << Polymorphism appears when we introduce type schemes, that is types > with universally quantified type variables. > ... > The polymorphism is only introduced by the definition of names during > a let construct (either local, or global). > >> > > The last sentence seems to contradict the first; the programmer doesn't > introduce type schemes. The first occurrence of ``we'' means we, type theorists, not we, actual programmers; in effect, as you said, there is no means for the Caml programmer to introduce type scheme parameters (or polymorphic variables as you said). (Except recently for method definitions, and the notation used could probably be extended to the rest of type constraints). You may also have a look at the french version: I may have made a mistake or oversimplification when translating into english. [...] > Also, why are class parameters enclosed in brackets ? > type 'a t = ... > but: > class ['a] t = ... > and not: > class 'a t = ... Ask Yacc! As far as I remember, we needed those explicit brackets to delimit type parameters of a class from type parameters of types, when mixing types and classes... > '_a variables > ------------- > > It is not possible to specify "impure" type variables: You are right, and it is probably desirable to clarify a lot of examples. > Variable name in error message > ------------------------------ > > Error messages would be more readable if they retained (when possible) > variable names: > > # let f (a : 'a) (b : 'b list) = b + 1;; > This expression has type 'a list but is here used with type int This is a long standing misfeature of Caml, that is unfortunately not at all easy to fix. Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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