caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeffrey Scofield <jeffsco@psellos.com>
To: caml-list@inria.fr
Subject: [Caml-list] Re: Native OCaml iPhone app now in iTunes Store
Date: 06 Jan 2011 17:32:35 -0600	[thread overview]
Message-ID: <m38vyxa9rg.fsf@pse.psellos.com> (raw)
In-Reply-To: <D73AF3B1-11F8-4228-80BC-28B966046B42@gmail.com>

Joel Reymont <joelr1@gmail.com> writes:

> > All the code is in OCaml; there's no ObjC except in the (thin)
> > wrappers around the native iOS libraries.  We wanted to write as
> > much in OCaml as possible.
> 
> How did you wrap the native libraries then?

We went through a few iterations of plans for generating wrappers
automatically.  But we determined that automatically generated
wrappers that follow Objective C idioms are too cumbersome to use from
OCaml.  An automatic tool is going to require a lot of human input on
data structure choices, at the very least.

What we did in the end was to design a basic framework with an OCaml
class for each ObjC class.  The method APIs use idiomatic OCaml types
for values and collections.  The support code uses Cocoa foundation
classes to do dynamic method invocation, so the amount of ObjC code in
each wrapper is kept to a minimum (typically there is none).  The
framework lets us build individual wrappers quickly and keeps things
coherent and consistent.  We code up wrappers by hand as we need them.

> I've been meaning to write a Cocoa bridge for OCaml but haven't
> gotten to it yet.

It would be a big project.

> Are your wrappers available?

We'll be happy to release source to our Cocoa wrapper layer once we
recoup some of our investment in it.  In the meantime we can offer
advice on things that worked and didn't work for us.


Regards,

Jeffrey

      parent reply	other threads:[~2011-01-06 23:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 19:38 [Caml-list] " Jeffrey Scofield
2011-01-04 20:16 ` Paolo Donadeo
2011-01-04 20:24   ` Yitzhak Mandelbaum
2011-01-04 20:49     ` Paolo Donadeo
2011-01-05  7:43   ` [Caml-list] " Jeffrey Scofield
2011-01-04 20:19 ` [Caml-list] " Joel Reymont
2011-01-05 16:14   ` [Caml-list] " Jeffrey Scofield
2011-01-05 17:06     ` Joel Reymont
2011-01-05 22:05       ` Andrei Formiga
2011-01-06 23:32       ` Jeffrey Scofield [this message]

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=m38vyxa9rg.fsf@pse.psellos.com \
    --to=jeffsco@psellos.com \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).