From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id C1FDE7FD92 for ; Fri, 10 Jun 2016 20:12:51 +0200 (CEST) IronPort-PHdr: 9a23:Ed2BRB/Ts2UZi/9uRHKM819IXTAuvvDOBiVQ1KB91+scTK2v8tzYMVDF4r011RmSDdSdtK0P0rOI+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U0Jv8jrnss7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cY6Lod8JtLWKD+OqA5VqBwDTI8Mmlz6te4mwPESF6v630QSGQV2jBPBA2NuBH3WJvrsyjSqu1l3yjcJcrxVPY/XjH0vPQjcwPhlCpSb21xy2rQkMEl1K8= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=hendrik@topoi.pooq.com; spf=None smtp.mailfrom=hendrik@topoi.pooq.com; spf=None smtp.helo=postmaster@april.topoi.pooq.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=pra; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=mailfrom; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@april.topoi.pooq.com) identity=helo; client-ip=69.165.131.134; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="postmaster@april.topoi.pooq.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ApJQDGAltX/4aDpUVehBRLATGCdrgvgXoih1cSAQEBAQEBAQFkJ0EBAQEBAQEIAgKBXYJWezQFGCWITw6dP6BtinSFDIJggi8FgUWXGoYEiBoKZoFRjGmPayUJJoE2DIJIIDIBgXuBbYJ2gykBAQE X-IPAS-Result: A0ApJQDGAltX/4aDpUVehBRLATGCdrgvgXoih1cSAQEBAQEBAQFkJ0EBAQEBAQEIAgKBXYJWezQFGCWITw6dP6BtinSFDIJggi8FgUWXGoYEiBoKZoFRjGmPayUJJoE2DIJIIDIBgXuBbYJ2gykBAQE X-IronPort-AV: E=Sophos;i="5.26,451,1459807200"; d="scan'208";a="180887655" Received: from topoi.pooq.com (HELO april.topoi.pooq.com) ([69.165.131.134]) by mail3-smtp-sop.national.inria.fr with ESMTP; 10 Jun 2016 20:12:24 +0200 Received: by april.topoi.pooq.com (Postfix, from userid 1001) id 2755A1A07F6; Fri, 10 Jun 2016 14:12:22 -0400 (EDT) Date: Fri, 10 Jun 2016 14:12:22 -0400 From: Hendrik Boom To: caml-list@inria.fr Message-ID: <20160610181222.GA27973@topoi.pooq.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [Caml-list] reverse coercions In http://caml.inria.fr/pub/docs/u3-ocaml/ocaml-objects.html it says: reverse coercions from a supertype to a supertype are never possible in OCaml. (a) Might one of these 'supertype's actually be a 'subtype'? (b) Is there any way to do a run-time type-test on a value of a specific statically known supertype to test whether it is actually a value of a known specified subtype, and if so to proceed to use it as that subtype? If so, I'd like to use this in a suite of pattern-directed rule invocations. If not, I'd like to know if there are any well-known efficient ways around this. Of course I can effectively Godel-encode my data structures using lists, and interpret all my patterns and the application types I woyd have rather expressed as OCaml types, but I'm looking for something more elegant, statically checked, and efficient. -- hendrik