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 TAA16005; Tue, 19 Jun 2001 19:26:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-announce@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA15952 for caml-announce@pauillac.inria.fr; Tue, 19 Jun 2001 19:26:29 +0200 (MET DST) 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 SAA13826 for ; Tue, 19 Jun 2001 18:24:33 +0200 (MET DST) Received: from cahors.inria.fr (cahors.inria.fr [128.93.8.84]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f5JGOWX26225 for ; Tue, 19 Jun 2001 18:24:32 +0200 (MET DST) Received: from localhost (cahors.inria.fr [128.93.8.84]) by cahors.inria.fr (8.11.0/8.8.7) with ESMTP id f5JGOWK29476 for ; Tue, 19 Jun 2001 18:24:32 +0200 To: caml-announce@inria.fr Subject: [Caml-announce] G'Caml, Caml with Extensional polymorphism extension X-Mailer: Mew version 1.94.2 on Emacs 20.5 / Mule 4.1 (AOI) X-URL: http://pauillac.inria.fr/~furuse/ Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010619182424P.Jun.Furuse@inria.fr> Date: Tue, 19 Jun 2001 18:24:24 +0200 From: Jun Furuse X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-announce@pauillac.inria.fr Precedence: bulk Hello, I'm pleased to announce G'Caml, the experimental extension of the extensional polymorphism([1],[2]) to O'Caml, available at http://pauillac.inria.fr/~furuse/generics/ You can define non parametric, ad-hoc polymorphic values (so called "overloaded" or "generic" functions) using newly added "generic" bindings. For example: # generic plus = case | int -> int -> int => (+) | float -> float -> float => (+.) ;; This defines an ad-hoc polymorphic function plus, which can work both for integer and float additions. # plus 1 2;; - : int = 3 # plus 1.2 3.4;; - : int = 4.6 Not only such overloaded arithmetic functions, we can define many interesting ad-hoc polymorphic values which cannot be imagined in the normal ML. G'Caml also provides dynamic values and a toplevel magic printing function, using the internal framework of extensional polymorphism implementation. We can encapsulate a value and its type into an object typed dyn. Then using this encapsulated type information, we can perform run time type checking: # dyn 1;; - : dyn = (1 : int) # coerce (dyn 1) with | (x : int) => Printf.printf "It is an int %d.\n" x | (x : float) => Printf.printf "It is a float %f.\n" x It is an int 1. - : unit = () The toplevel magic printing is the function which many people have asked for in this list. It can print out any ML value (well, functions are just printed as ), including the constructor names of user defined types (this is available only in the toplevel): # type foo = Foo of int;; # Toploop.print (Foo 42);; Foo 42- : unit = () G'Caml is still quite experimental and under development. I am sure that there are tons of bugs. Do not expect something almost complete, like the initial O'Labl release... I hope you could enjoy it. -- JPF [1] "Extensional Polymorphism". Catherine Dubois, Francois Rouaix, Pierre Weis. Proceedings POPL 95. ftp://ftp.inria.fr/INRIA/Projects/cristal/Francois.Rouaix/generics.dvi.Z [2] "Generic polymorphism in ML". Jun Furuse. Journees Francophones des Langages Applicatifs 2001 http://pauillac.inria.fr/~furuse/publications/jfla2001.ps.gz