Re: Thinking (again) about an Objective-C bridge

Bruce Mitchener <[email protected]> Tue, 18 Jun 2013 22:34:07 +0700
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CA+esKjNBpeQm1ja+Dxz7__XmUyLHz=curjDhVJnaH_K8VKvfmg@mail.gmail.com>
On Tue, Jun 18, 2013 at 9:29 PM, Matthew Sinclair-Day <[email protected]>wrote:

> The obj-c runtime provides functions for converting a string to a selector
> and for introspecting a method for its parameter types.  There will be some
> variations when a Dylan object maps onto, say, an int, not NSNumber, but it
> appears straight forward to handle these cases.
>

The conversion from string to selector and back is already handled in my
library.

The parameter type info, as far as I know, is best obtained by working with
Bridge Support.  In my ideal world, we'd modify melange to support reading
in BridgeSupport data (instead of a header) and use it to generate bindings.

Another consideration is memory management and handling the deallocation of
> objects returned by the objc runtime. Not knowing much about how Dylan
> works, I assume there is a way to handle this reliably so that when Dylan
> objects are garbage collected, objc ones in there slots can be dealloc'ed.
>

Dylan objects can register a finalizer for handling things like that.   See
http://opendylan.org/documentation/library-reference/common-dylan/finalization.htmlfor
details on that.

It would be nice to find a way to integrate with ARC, but I don't know how
or where that's implemented in the normal Clang / LLVM toolchains.

 - Bruce

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers