[Mono-list] Re: Is Objective-C support possible?

Yonas Jongkind yonasj@goodue.com
Fri, 15 Feb 2002 10:05:50 -0800

I however, may be qualified to help a little bit here, as a long time 
Objective-C programmer.

Were you to write Objective-C support for .NET the biggest performance 
challenge would be getting selectors to work. The method dispatch system in 
.NET is vtable oriented, but Objective-C is based on dynamic dispatch.

You could use the reflection calls to dispatch a selector on every call, 
but this would be slow. Or you could implement sarray (Sparse Arrays) to do 
dynamic dispatch, however using sarray would make Objective-C objects 
incompatible with .NET objects.  :(

This was a design tradeoff by the .NET designers, vtables are fast and 
dynamic dispatch is awesome.  Dynamic dispatch makes Objective-C what it is.
  MS chose fast...

Any by the way, Categories are __AWESOME__. They allow you to customize 
classes in ways that are not possible in other systems. These people often 
resort to hacks like __FACTORIES__.

Quick lesson on Categories (not interfaces). Categories are not multiple 
inheritance, they are still single inheritance. However the inheritance 
chain is dynamic at runtime, so you can insert new classes into the chain.

However you could add the categories to the system using some re-naming 
tricks at runtime by injecting new types into the system.