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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 24C28BB81 for ; Sun, 2 Oct 2005 02:06:13 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j9206C0o019175 for ; Sun, 2 Oct 2005 02:06:12 +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 CAA13834 for ; Sun, 2 Oct 2005 02:06:12 +0200 (MET DST) Received: from anthony.ics.uci.edu (anthony.ics.uci.edu [128.200.39.241]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id j9206AUl007518 for ; Sun, 2 Oct 2005 02:06:11 +0200 Received: (qmail 30801 invoked by uid 1000); 2 Oct 2005 00:06:09 -0000 Date: Sat, 1 Oct 2005 17:06:09 -0700 From: Christian Stork To: Caml List Subject: UsingPolymorphic Variants Message-ID: <20051002000609.GA30761@anthony.ics.uci.edu> Mail-Followup-To: Caml List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Archive: encrypt User-Agent: Mutt/1.5.11 X-Miltered: at concorde with ID 433F2474.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 433F2472.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; variants:01 variants:01 coerced:01 extensively:01 coercions:01 coercions:01 compiler:01 ...:98 ...:98 806:98 021:98 polymorphic:01 polymorphic:01 compile:01 explicitly: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.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Basic Question: Why aren't polymorphic variants coerced by default? My Situation: I am automatically generating some code that uses polymorphic variants extensively. The inferred types are very complicated. Unfortunatly, at some points in my code coercions are needed for it to compile. Since I don't have the types available when I generate the code (and I don't think it's possible to refer to inferred types in coercions) I can't coerce explicitly. I'd like to be able to say something like: ... f (x: type_of_x :> type_expected_by_f) ... Anyway, that's why I'm wondering why the compiler doesn't automatically coerce or, at least, offer a switch with this functionality. Thanks for your time, Chris -- Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/ OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F