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.3 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 8FB50BBAF for ; Wed, 17 Dec 2008 21:33:02 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.36,239,1228086000"; d="scan'208";a="32796619" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Dec 2008 21:33:02 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mBHKX1al026846 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 17 Dec 2008 21:33:01 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkwBAFPwSEnRVdoKimdsb2JhbACTHz4BAQEKCQwHDwWqbViEWIxBAQMBA4MDgj0 X-IronPort-AV: E=Sophos;i="4.36,238,1228086000"; d="scan'208";a="21428976" Received: from mail-bw0-f10.google.com ([209.85.218.10]) by mail1-smtp-roc.national.inria.fr with ESMTP; 17 Dec 2008 21:33:01 +0100 Received: by bwz3 with SMTP id 3so165096bwz.9 for ; Wed, 17 Dec 2008 12:33:00 -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:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=eNgqvSeALvhl92mwbYi7LJjz0mH0rb2wje1c/l4J2E8=; b=PU88Q4+eO5epPONNPIoYQlsvmAIflXRXSdMejyFK06abXR4FTo0s76P7Vw6TOCO1rT Lay4uj7Zx80w0hUF8P8cGO9Hz4jJbwchWVuGPD+Sb6Uyc6C2pulobbeMNEPsFBaJqk0H bJZDEW8j8f4b4oLN0aVxkeOhQWAwYypCEil8Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=GcUnoXw5/LCrhqQkR6IP+fXUTOZkV5ItcvkiaFzcGL+DfCQmXM7LOE7Irhyjph8AGg XYOXntBPdZ5wJ3WYAkc648nowjP1R+L/2/nV8SyQu/Pd05Qq5tfG/d6EKU2r4Uc8pOg/ soK5c6meAc0v/YWcp9VjJcIqBhRhT93gqewN4= Received: by 10.181.145.7 with SMTP id x7mr372823bkn.96.1229545790641; Wed, 17 Dec 2008 12:29:50 -0800 (PST) Received: by 10.181.203.8 with HTTP; Wed, 17 Dec 2008 12:29:50 -0800 (PST) Message-ID: Date: Wed, 17 Dec 2008 21:29:50 +0100 From: "=?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?=" Sender: mikkelfj@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: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <494956BD.9030000@mcmaster.ca> X-Google-Sender-Auth: ef2244b5f229ba0a X-Miltered: at concorde with ID 494961FD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; mikkel:01 rgensen:01 mikkel:01 ocaml:01 ocaml:01 integers:01 parser:01 untyped:01 node:01 node:01 corresponds:01 multiplying:01 git:98 config:01 typing:01 Hi Jacques > 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. I'm not really sure I understand exactly what problem you are trying to solve. But if it is flexible dynamic data structure that can optionally be associated with a type tag you can take a look at the source Symbiosis implementation http://dvide.com/labs/symbiosis/ http://git.dvide.com/pub/symbiosis/tree/myocamlbuild_config.ml Most of this code is a java script object parser (JSON) which generates an mostly untyped JSON object tree of lists and maps, but still has basic float, int and string types. The actual Symbiosis logic is a thin layer on top of this to access different configuration logic. One interesting part of this is the object navigation: each node is represented as where node is one of the basic JSON types. Any navigation into the JSON tree results in a new position, but the position remains separate from the tree. Whenever an expected value is not found, an exception is thrown and the position is used to report the error location. In some sense this attached position corresponds to dynamic type information. You could view navigation as a computation and attach type. For example matrix multiplying two JSON lists and attached the resulting dimensions to the resulting JSON object tree. I guess this can also be formulated as a monad somehow. Perhaps this can be of some inspiration, or perhaps it is a different problem you are trying to solve. Regards, Mikkel