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=1.2 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id A869CBC69 for ; Sun, 10 Jun 2007 22:02:41 +0200 (CEST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5AK2edO007032 for ; Sun, 10 Jun 2007 22:02:41 +0200 Received: by py-out-1112.google.com with SMTP id u52so2223925pyb for ; Sun, 10 Jun 2007 13:02:40 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=Lx/Rg7YrAr1I2NO5Njw5PCeXTV/JOWGrhl6ezjibr9dGQLzuZuWT4Xa1vL3YP4ARmZ/D8l2qPpP1IpJoCOc5y35hghP0MGPCIY1enaHYyZe9vAudXPz+x183s+Pemt+8s6UGAkpWOGNEQT8ry4vr8yhwWXdlLDRntG4Zmn3UfVs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=ttnE/6ZdUJr3vFWr1bxvuyKhkZ2pEK7HJ8zFq0q2LLaE+kUBWk+sx8wdnaW3j56/+fQQpv+IwsxACy10RLCKMrSBN9hikDt7hOrU67eIpoH4D1ns6zROZyHkzT99SXMHZeDOMUFJhsI0qbxLpY8JlMujt7ENtDnYVnIHjtIAhUs= Received: by 10.114.202.15 with SMTP id z15mr4750372waf.1181505759376; Sun, 10 Jun 2007 13:02:39 -0700 (PDT) Received: by 10.114.52.9 with HTTP; Sun, 10 Jun 2007 13:02:39 -0700 (PDT) Message-ID: <891bd3390706101302h443da391x9a4bef15da9c730f@mail.gmail.com> Date: Sun, 10 Jun 2007 16:02:39 -0400 From: "Yaron Minsky" Sender: yminsky@gmail.com To: "Joel Reymont" Subject: Re: [Caml-list] camlp4 and class introspection Cc: "Jonathan Bryant" , caml-list@yquem.inria.fr In-Reply-To: <7C9995D9-AC11-4E7C-8477-25CA4B88A0F4@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_86835_18746058.1181505759338" References: <7C9995D9-AC11-4E7C-8477-25CA4B88A0F4@gmail.com> X-Google-Sender-Auth: a8779dbbebb5990a X-Miltered: at discorde with ID 466C58E0.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 camlp:01 foo:01 camlp:01 inference:01 runtime:01 ocaml:01 compilation:01 haskell:01 haskell:01 beginner's:01 ocaml:01 bug:01 ------=_Part_86835_18746058.1181505759338 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I actually think you can do this kind of thing with a combination of type-directed programming and macros. A similar kind of introspection-like capabilities is achieved with the s-expression macros that we've released. You would need to apply your macros to every type referenced by your objects, not just to the object definitions themselves (otherwise, how is the system to know that the value of type [foo] you refer to somewhere in your object is really defined as [int * int] somewhere else?) y On 6/10/07, Joel Reymont wrote: > > > On Jun 10, 2007, at 1:14 AM, Jonathan Bryant wrote: > > > I don't think this would be possible since CamlP4 happens before > > type inference and therefore knows nothing about types. > > That's really too bad. I was thinking of recognizing that type X was > used for instance variables, for example, and generating code to > register these appropriately with the Objective-C runtime. > > I guess I could build a standalone tool to process OCaml class > definitions and do this but I would rather have it as part of the > regular compilation workflow. > > So, in a word, there's no way to achieve what I'm looking for? > Haskell people do this using Template Haskell and Camlp4 provides > very similar capabilities. > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# translator > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > 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_86835_18746058.1181505759338 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I actually think you can do this kind of thing with a combination of type-directed programming and macros.  A similar kind of introspection-like capabilities is achieved with the s-expression macros that we've released.  You would need to apply your macros to every type referenced by your objects, not just to the object definitions themselves (otherwise, how is the system to know that the value of type [foo] you refer to somewhere in your object is really defined as [int * int] somewhere else?)

y

On 6/10/07, Joel Reymont <joelr1@gmail.com> wrote:

On Jun 10, 2007, at 1:14 AM, Jonathan Bryant wrote:

> I don't think this would be possible since CamlP4 happens before
> type inference and therefore knows nothing about types.

That's really too bad. I was thinking of recognizing that type X was
used for instance variables, for example, and generating code to
register these appropriately with the Objective-C runtime.

I guess I could build a standalone tool to process OCaml class
definitions and do this but I would rather have it as part of the
regular compilation workflow.

So, in a word, there's no way to achieve what I'm looking for?
Haskell people do this using Template Haskell and Camlp4 provides
very similar capabilities.

        Thanks, Joel

--
http://topdog.cc      - EasyLanguage to C# translator
http://wagerlabs.com  - Blog





_______________________________________________
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_86835_18746058.1181505759338--