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=2.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 5DF64BBAF for ; Thu, 18 Dec 2008 02:16:44 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.36,240,1228086000"; d="scan'208";a="32802851" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Dec 2008 02:16:44 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id mBI1GhXW025353 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 18 Dec 2008 02:16:43 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsCALUySUnRVdoKimdsb2JhbACCPjGQMD4BAQEKCQwHDwWpaliDVAh8jDgBAwEDgwOBdw X-IronPort-AV: E=Sophos;i="4.36,240,1228086000"; d="scan'208";a="20528008" Received: from mail-bw0-f10.google.com ([209.85.218.10]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Dec 2008 02:16:42 +0100 Received: by bwz3 with SMTP id 3so428668bwz.9 for ; Wed, 17 Dec 2008 17:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type:references; bh=0Jmr/Va7Gvrq9/zpF+lwz9yJH3mRaFslxQlsbUNh/gQ=; b=LlIeWlwYxn4+v7yMPZsItwa3FGpU+g8hkiWbYCo9EPiXJE/dR9nzBca5tHGOsXtm3h 08ECN2Er/mMlCyN0bNlWy+3DPkFsJM27qnIbhYFsXGtcFZvs8wyzXXGZts621C4QbmnO iBD68cKveijgvNOWjTowCkKim4ngHvko2f92Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:references; b=Kwvg7RyOYgn3irAGx8m3IT41oJggG7iLpFog46ytBke4J8SssLYJ8Dgzylj/j10oDW 9REpXa0sQR6oMQIBULPwgfrDswYOrOh2ngE7LqbvzRhB6iMWcvJIv9QM0ZomaDrcgrDh kQu9GW5ULwWEqOw8AJ8egI7kc9rl0zV/JP0gA= Received: by 10.180.249.4 with SMTP id w4mr449550bkh.162.1229563002656; Wed, 17 Dec 2008 17:16:42 -0800 (PST) Received: by 10.181.212.7 with HTTP; Wed, 17 Dec 2008 17:16:42 -0800 (PST) Message-ID: <891bd3390812171716m6652ddf9sd4d7db5221f7b898@mail.gmail.com> Date: Wed, 17 Dec 2008 20:16:42 -0500 From: "Yaron Minsky" Reply-To: yminsky@gmail.com To: "Jacques Carette" Subject: Re: [Caml-list] Typing Dynamic Typing in ocaml? Cc: OCaml In-Reply-To: <494956BD.9030000@mcmaster.ca> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9414_24884524.1229563002637" References: <494956BD.9030000@mcmaster.ca> X-Miltered: at discorde with ID 4949A47B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 ocaml:01 ocaml:01 node:01 computations:01 integers:01 variants:01 variants:01 compiler:01 beginner's:01 bug:01 node:01 computations:01 ------=_Part_9414_24884524.1229563002637 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline The following blog post might be of use. http://ocaml.janestreet.com/?q=node/18 y On Wed, Dec 17, 2008 at 2:45 PM, Jacques Carette wrote: > I have two (related) questions: > 1) Has anyone transcribed the TypeRep library into ocaml? > http://people.cs.uu.nl/arthurb/dynamic.html > > 2) How do I embed 'dynamically known' data into a single ocaml > data-structure? > > More specifically, I am experimenting with a (new) language which allows > deduction and computations to be performed with equal ease on its terms. > This language uses ocaml has the host meta-language (ie the interpreter is > written in ocaml). I would like to be able to use arbitrary ocaml > data-structures to represent some of my terms, when these terms are known to > come from specific theories. For example, I would like to use Bigint to > represent integers, but without exposing that per se. Perhaps a better way > to phrase this would be to say that I want to have a "generic external data > container" type in my language terms, which I can instantiate in multiple > different ways (in the same program), with data handled in different > modules, without having to change the 'generic' data-structure everytime I > add a new module. > > Polymorphic variants of course come to mind - but they would force me to > add a new type parameter to all my types, which I would rather avoid. I > would be quite happy to use polymorphic variants if I could 'hide away' the > extra type parameter involved with open variants. My attempts at hiding > this parameter (with existentials) has been too successful, in that once > hidden I can't extract my data from this container anymore [which is the > correct behaviour for the compiler]. > > I thought of using objects too, but my data does not really have any common > structure, so the object would be a pure container. I cannot see any > advantage over polymorphic variants, and all the same headaches of an > 'extra' polymorphic parameter remain. > > Jacques > > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ------=_Part_9414_24884524.1229563002637 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline The following blog post might be of use.

   http://ocaml.janestreet.com/?q=node/18

y

On Wed, Dec 17, 2008 at 2:45 PM, Jacques Carette <carette@mcmaster.ca> wrote:
I have two (related) questions:
1) Has anyone transcribed the TypeRep library into ocaml?
http://people.cs.uu.nl/arthurb/dynamic.html

2) How do I embed 'dynamically known' data into a single ocaml data-structure?

More specifically, I am experimenting with a (new) language which allows deduction and computations to be performed with equal ease on its terms.  This language uses ocaml has the host meta-language (ie the interpreter is written in ocaml).  I would like to be able to use arbitrary ocaml data-structures to represent some of my terms, when these terms are known to come from specific theories.  For example, I would like to use Bigint to represent integers, but without exposing that per se.  Perhaps a better way to phrase this would be to say that I want to have a "generic external data container" type in my language terms, which I can instantiate in multiple different ways (in the same program), with data handled in different modules, without having to change the 'generic' data-structure everytime I add a new module.

Polymorphic variants of course come to mind - but they would force me to add a new type parameter to all my types, which I would rather avoid.  I would be quite happy to use polymorphic variants if I could 'hide away' the extra type parameter involved with open variants.  My attempts at hiding this parameter (with existentials) has been too successful, in that once hidden I can't extract my data from this container anymore [which is the correct behaviour for the compiler].

I thought of using objects too, but my data does not really have any common structure, so the object would be a pure container.  I cannot see any advantage over polymorphic variants, and all the same headaches of an 'extra' polymorphic parameter remain.

Jacques



_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

------=_Part_9414_24884524.1229563002637--