Le 11 janv. 07 à 18:04, David Chisnall a écrit :

I keep seeing things that use GObject that could be useful (GEGL was the latest one).

Has anyone investigated the idea of using GObject and Objective-C together?

Banlu Kemiyatorn may be…
iirc GNOME supported objective-c as a development language in the past, it may still hold. So you might check how they solve the problem back then.

The object models seem very similar, but the implementations are quite different. There are a few approaches I can see that might work:

1) Writing a parser that would take a GObject header and spit out a corresponding Objective-C class. This would work, but would only give us access to objects we knew about at compile time.

Not really convinced by this one.

2) Writing a GObjectWrapper class, that would use forwardInvocation: to pass on messages to the corresponding functions. This would lose us any kind of nice type checking, but would be relatively clean, assuming GObject stores enough information to get method names at runtime...

This could be done as a first step. This looks a lot like a language bridge in fact.

3) Modifying the GNU Objective-C runtime so that it does this mapping for us, and lets us use GObjects as Objective-C objects directly. This would be ideal, but it would require some significant modifications to the objc_msgSend mechanism. Ideally, if I were to do this, I would wrap around the objc_object structure up in something that would include an object_type element. This would then contain a set of function pointers to equivalents of objc_msgSend, thus allowing us to add support for future object representations, but it would break binary compatibility with absolutely everything...

I like this idea, but it should be probably done as a second step.
We could imagine having a generic structure to wrap object structures within various languages, this would allow to have more transparent and faster language bridges since we wouldn't rely on proxies anymore and thereby we would also share the same object pointer address across languages. I'm quite surprised nobody already comes up with such a solution to simplify and enhance language bridge development.

Cheers,
Quentin.

--
Quentin Mathé
[EMAIL PROTECTED]


_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to