Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-06-11 (00:58)
From: Jacques GARRIGUE <garrigue@m...>
Subject: Re: [Caml-list] camlp4 and class introspection
From: Joel Reymont <>
> 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 don't know which classes you want to register with the Objective-C
runtime, but an option is to require users to write .mli files (not
too hard since they can be generated with ocamlc -i).
Then you can use camlp4 to parse the .mli and generate the
registration code to be included in the .ml file. You just have to be
careful about "open" statements.

Jacques Garrigue