[erlang-questions] Parsing Objective C type encodings

Geoff Cant nem@REDACTED
Thu May 31 23:47:03 CEST 2007


"Joe Armstrong" <erlang@REDACTED> writes:

> Hi,
>
> It would be nice to build something like F-Script or RubyCocoa only in Erlang
>
> Is there any Erlang code for obtaining and parsing Objective C type encodings?
>
> Any progress since
>
> http://www.erlang.org/pipermail/erlang-questions/2006-August/021926.html
>
> Is it actually necessary to parse the objective C header files? -
> won't run-time introspection
> be sufficient.

I've written an objc runtime type signature parser in common lisp
(http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi?r=cl-objc-cl-objc;a=headblob;f=/objc-types.lisp)
which I could port to yecc if you'd like.

It will give you enough information to safely call objc_msg_send (you
can tell which arguments should be objects, classes, c-strings, ...),
but not enough to catch errors that might occur if you pass the wrong
type of object (that information is only available in the header
files).

Has someone written erlang bindings for the objective-c runtime
library?
(http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html#//apple_ref/doc/uid/TP40001418)
Bindings to these methods allow you to inspect all the loaded
classes/methods, create instances, new classes, new methods, call methods etc.

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html
has some information on the type signatures the objc runtime uses.

Cheers,
-- 
Geoff




More information about the erlang-questions mailing list