From: Martin Jambon <martin_jambon@emailuser.net>
To: Joel Reymont <joelr1@gmail.com>
Cc: Jacques GARRIGUE <garrigue@math.nagoya-u.ac.jp>,
jtbryant@valdosta.edu, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] camlp4 and class introspection
Date: Mon, 11 Jun 2007 12:11:11 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706111156290.14234@martin.ec.wink.com> (raw)
In-Reply-To: <A466AABB-AE76-4E11-B533-6740807A3C70@gmail.com>
On Mon, 11 Jun 2007, Joel Reymont wrote:
>
> On Jun 11, 2007, at 1:58 AM, Jacques GARRIGUE wrote:
>
>> Then you can use camlp4 to parse the .mli and generate the
>> registration code to be included in the .ml file.
>
> Right. I want to parse the class definition to extract instance variable
> types and method signatures. Then I can use this information to create calls
> to the Objective-C runtime.
>
> If there's an instance variable of type "float outlet", for example, then
> I'll know to strip outlet from OCaml code and to tell ObjC that it's an
> outlet. The whole purpose is to be able to define ObjC classes in OCaml while
> automatically creating the glue and bridging code.
I see 2 main options:
- parse type definitions in standard OCaml syntax (what Jacques
suggested): you can use an external
preprocessor, the program can be compiled independently from camlp4, and
you would discard type definitions that can't be converted to Objective-C.
Another advantage is that you could use other similar preprocessors to
generate code for other purposes.
- introduce a special kind of type definitions (like Yaron suggested), so
that only these would generate Objective-C code. The big advantage is that
you could add options. For example, if an OCaml type has 2 equivalents in
Objective-C, you could add an annotation to choose which one to use.
It makes OCaml-like type definitions, which usually do not cover all
possible type definitions and are not compatible with standard OCaml.
Martin
next prev parent reply other threads:[~2007-06-11 10:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-09 22:59 Joel Reymont
2007-06-10 0:14 ` [Caml-list] " Jonathan Bryant
2007-06-10 12:30 ` Joel Reymont
2007-06-10 20:02 ` Yaron Minsky
2007-06-10 21:18 ` Joel Reymont
2007-06-10 22:07 ` Yaron Minsky
2007-06-11 0:58 ` Jacques GARRIGUE
2007-06-11 8:05 ` Joel Reymont
2007-06-11 10:11 ` Martin Jambon [this message]
2007-06-11 10:16 ` Joel Reymont
2007-06-11 11:36 ` Martin Jambon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0706111156290.14234@martin.ec.wink.com \
--to=martin_jambon@emailuser.net \
--cc=caml-list@yquem.inria.fr \
--cc=garrigue@math.nagoya-u.ac.jp \
--cc=joelr1@gmail.com \
--cc=jtbryant@valdosta.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox