From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 87FCFBCAF for ; Fri, 10 Jun 2005 14:56:30 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5ACuUCk024179 for ; Fri, 10 Jun 2005 14:56:30 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA04756 for ; Fri, 10 Jun 2005 14:56:29 +0200 (MET DST) Received: from ZIVLNX17.uni-muenster.de (ZIVLNX17.UNI-MUENSTER.DE [128.176.188.79]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5ACuR9S024165 for ; Fri, 10 Jun 2005 14:56:29 +0200 Received: from localhost (localhost [127.0.0.1]) by ZIVLNX17 (Postfix) with ESMTP id 14B28E000719; Fri, 10 Jun 2005 14:50:16 +0200 (CEST) Received: from ZIVLNX17.uni-muenster.de ([127.0.0.1]) by localhost (ZIVLNX17 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04475-04; Fri, 10 Jun 2005 14:50:15 +0200 (CEST) Received: from [128.176.151.28] (VPNPOOL01-0274.UNI-MUENSTER.DE [128.176.151.28]) by ZIVLNX17 (Postfix) with ESMTP id 41648E000784; Fri, 10 Jun 2005 14:50:13 +0200 (CEST) In-Reply-To: References: <20050609212234.GA32710@furbychan.cocan.org> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: caml-list@inria.fr From: Wolfgang Lux Subject: Re: [Caml-list] Re: type t = () Date: Fri, 10 Jun 2005 14:56:34 +0200 To: Vincenzo Ciancia X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new at uni-muenster.de X-Miltered: at nez-perce with ID 42A98DFE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42A98DFB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; wlux:01 uni-muenster:01 caml-list:01 printf:01 printf:01 compiler:01 ocaml:01 ocaml:01 overload:01 sml:01 haskell:01 wrote:01 wrote:01 defining:01 constructor:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Vincenzo Ciancia wrote: > Richard Jones wrote: > >> # type dummy = ();; >> type dummy = () >> # let () = Printf.printf "hello";; >> This expression has type unit but is here used with type dummy >> > > It seems that the compiler accepted "()" as a type constructor, so now > every > instance of "()" is the only constructor of type "dummy" e.g. Sorry for nitpicking, but in this case () is a *data* constructor. I guess, Rich would have been more happy if OCaml did recognize () as a type constructor in this example. However, I guess one cannot do much about this in OCaml since () is a legitimate data constructor name. The problem really is that the (O)Caml designers chose to overload the type keyword for defining algebraic data types as well as type abbreviations. Compare with SML and Haskell where different keywords are used. Regards Wolfgang