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 2D721BC48 for ; Thu, 7 Apr 2005 02:13:15 +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 j370DEFZ032101 for ; Thu, 7 Apr 2005 02:13:14 +0200 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 CAA22098 for ; Thu, 7 Apr 2005 02:13:14 +0200 (MET DST) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j370DC6r020351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 7 Apr 2005 02:13:14 +0200 Received: from localhost (localhost [127.0.0.1]) by nexus.stwing.upenn.edu (Postfix) with ESMTP id 6AE2464901 for ; Wed, 6 Apr 2005 20:13:12 -0400 (EDT) Received: from nexus.stwing.upenn.edu ([127.0.0.1]) by localhost (nexus.stwing.upenn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02886-09 for ; Wed, 6 Apr 2005 20:13:12 -0400 (EDT) Received: from force.stwing.upenn.edu (force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (Postfix) with ESMTP id 12740648DC for ; Wed, 6 Apr 2005 20:13:12 -0400 (EDT) Received: by force.stwing.upenn.edu (Postfix, from userid 5302) id AABFF31F10; Wed, 6 Apr 2005 20:13:11 -0400 (EDT) Date: Wed, 6 Apr 2005 20:13:10 -0400 From: William Lovas To: caml-list@inria.fr Subject: Re: [Caml-list] ambitious proposal: polymorphic arithmetics Message-ID: <20050407001308.GA26438@force.stwing.upenn.edu> Mail-Followup-To: caml-list@inria.fr References: <20050406.111505.68543084.eijiro_sumii@anet.ne.jp> <20050406163915.GC15547@force.stwing.upenn.edu> <20050406.153356.35007840.eijiro_sumii@anet.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050406.153356.35007840.eijiro_sumii@anet.ne.jp> User-Agent: Mutt/1.5.6i X-Virus-Scanned: amavisd-new at stwing.upenn.edu X-Miltered: at nez-perce with ID 42547B1A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42547B19.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 upenn:01 caml-list:01 eijiro:01 sumii:01 lovas:01 wlovas:01 stwing:01 upenn:01 abstraction:01 val:01 abstr:01 sig: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: On Wed, Apr 06, 2005 at 03:33:56PM -0400, Eijiro Sumii wrote: > From: "William Lovas" > > (This argument breaks down in > > the face of code which relies on abstract types to enforce modularity -- in > > such cases, incomparability can become "the rule" rather than the > > exception, putting =, <, etc. on the same footing as +, -, etc.) > > Yes, polymorphic comparison already breaks type abstraction. I did not realize this! Can somebody explain the following interactions? # let r = Ratio.ratio_of_int 5;; val r : Ratio.ratio = # r = r;; Exception: Invalid_argument "equal: abstract value". # module M : sig type t;; val of_int : int -> t end = struct type t = int;; let of_int x = x end;; module M : sig type t val of_int : int -> t end # let t = M.of_int 5;; val t : M.t = # t = t;; - : bool = true I thought that perhaps all comparisons of abstract values resulted in a runtime error, but evidently i was mistaken :/ What's the secret to making a type "really" abstract? William