From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C2B6BBB84 for ; Fri, 18 Jul 2008 15:02:57 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAOswgEiCNhAB/2dsb2JhbACvJw X-IronPort-AV: E=Sophos;i="4.31,210,1215381600"; d="scan'208";a="13242176" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Jul 2008 15:02:56 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id m6ID2TNa015512; Fri, 18 Jul 2008 22:02:29 +0900 (JST) Date: Fri, 18 Jul 2008 22:02:14 +0900 (JST) Message-Id: <20080718.220214.241921104.garrigue@math.nagoya-u.ac.jp> To: jeremy.yallop@ed.ac.uk Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Troublesome nodes From: Jacques Garrigue In-Reply-To: <488066C9.4050904@ed.ac.uk> References: <487F2609.1080708@ed.ac.uk> <20080718.113447.241468128.garrigue@math.nagoya-u.ac.jp> <488066C9.4050904@ed.ac.uk> X-Mailer: Mew version 4.2 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; nodes:01 nat:01 sig:01 val:01 val:01 struct:01 nat:01 bug:01 abbreviation:01 expansions:01 caml-list:01 coercion:01 int:01 int:01 behaviour:01 From: Jeremy Yallop > I don't yet understand exactly how private abbreviations are supposed to > work. The currently implemented behaviour doesn't accomplish what I > understand to be the intention. For example, given > > module Nat : > sig > type t = private int > val z : t > val s : t -> t > end = > struct > type t = int > let z = 0 > let s = (+) 1 > end > > we can write > > # (((Nat.z : Nat.t :> int) - 1) :> Nat.t);; > - : Nat.t = -1 It looks like you've found a serious bug in the current implementation. Actually you don't even need a coercion: # (((Nat.z : Nat.t :> int) - 1) : Nat.t);; - : Nat.t = -1 This should certainly not be accepted, as you can see by writing # (((Nat.z : Nat.t :> int) - 1) : int :> Nat.t);; (* fails *) I think I know the reason, which is probably related to the way abbreviation expansions are cached, but this needs more investigating. Jacques Garrigue