Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 and class introspection
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron Minsky <yminsky@c...>
Subject: Re: [Caml-list] camlp4 and class introspection
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
>