From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 682E1BBBB for ; Wed, 1 Mar 2006 12:10:30 +0100 (CET) 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 k21BATot026553 for ; Wed, 1 Mar 2006 12:10:29 +0100 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 MAA29315 for ; Wed, 1 Mar 2006 12:10:29 +0100 (MET) Received: from Smtp.neuf.fr (sp604001mt.neufgp.fr [84.96.92.60]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k21BAS5e022793 for ; Wed, 1 Mar 2006 12:10:29 +0100 Received: from bolet.myco.ath.cx ([84.4.27.30]) by sp604001mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-4.03 (built Sep 22 2005)) with ESMTP id <0IVG00E174DG3YY1@sp604001mt.gpm.neuf.ld> for caml-list@inria.fr; Wed, 01 Mar 2006 12:10:28 +0100 (CET) Received: from localhost ([127.0.0.1] helo=myco.ath.cx ident=www-data) by bolet.myco.ath.cx with smtp (Exim 4.50) id 1FEPDp-0002pp-RR; Wed, 01 Mar 2006 12:10:21 +0100 Date: Wed, 01 Mar 2006 12:10:21 +0100 From: Louis Gesbert Subject: Re: [Caml-list] Bugs with pattern-matching and exceptions In-reply-to: <200602281333.52448.jon@ffconsultancy.com> To: Jon Harrop Cc: caml-list@inria.fr Reply-To: louis.gesbert@laposte.net Message-id: MIME-version: 1.0 X-Mailer: Hastymail 1.4 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 References: <200602281333.52448.jon@ffconsultancy.com> X-j-chkmail-Score: MSGID : 44058125.000 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44058125.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44058125.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 marshalling:01 marshalling:01 redefined:01 exn:01 exn:01 toplevel:01 o'caml:01 o'caml:01 non-standard:01 run-time:01 equality:01 exception:01 exception:01 exceptions:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 > Can you reproduce this failure of the type system in the top-level > without using marshalling? I haven't been able to. Yes, this was without marshalling: when you use an alias to an exception which has been redefined afterwards, some type information seems to be lost by the top-level. # type t = X;; type t = X # exception E of t;; exception E of t # exception E' = E;; exception E' of t # E' X;; - : exn = E X # exception E of string;; exception E of string # E' X;; - : exn = E 0 Here we alias E with E', then redefine E (no matter with what), and E' shows its argument as int... However, this seems to be only a problem with the toplevel pretty-printer, not a real type problem since I didn't manage to make O'Caml accept badly typed expressions this way. This is with O'Caml 3.09.1. I guess this is linked to the problems of equality and marshalling: exceptions are non-standard variant types which confuse the run-time in some dark corners.