Objective-C and runtime type inspection

Bob Ippolito bob@REDACTED
Thu Aug 17 20:37:08 CEST 2006


Have you used Objective-C lately Ryan? There are plenty of structures
various other non-object data types used in common method calls. Joel
definitely knows at least something about what he's talking about.

NSPoint, NSError**, etc.

However for the majority of cases, you can determine the arity and
argument types of an Objective-C selector from the runtime. You'll
still likely have problems with varargs and paired arguments, e.g.
+[NSArray arrayWithObjects:...] and +[NSArray
arrayWithObjects:count:]. In PyObjC we do use a header parser, but
only to provide metadata for special cases.

-bob

On 8/17/06, Ryan Rawson <ryanobjc@REDACTED> wrote:
> what structures?  There _are_ no structures to inspect... All you have
> is an opaque object reference that you can then send messages to.
>
> Objective C is more like smalltalk than C++/Java/etc.  You cannot mess
> with the fields of an object.  They are 100% opaque (technically they
> are C structs, but you are asking for trouble to inspect them).
>
> Also, why doesn't your email thread up with the other message?
>
> -ryan
>
> On 8/17/06, Joel Reymont <joelr1@REDACTED> wrote:
> >
> > On Aug 17, 2006, at 6:01 PM, Ryan Rawson wrote:
> >
> > > In fact, why bother with run-time type inspection?  Just send a
> > > message to an object and be prepared to handle the exception...
> >
> > To perform translations of structures and the like, I suppose.
> >
> > --
> > http://wagerlabs.com/
> >
> >
> >
> >
> >
> >
>



More information about the erlang-questions mailing list