D/Objective-C: hit a dead end, start anew

Jacob Carlborg doob at me.com
Fri Sep 17 08:50:51 PDT 2010


On 2010-09-17 16:56, Michel Fortin wrote:
> On 2010-09-17 10:06:27 -0400, Jacob Carlborg <doob at me.com> said:
>
>> Have you thought about what needs to be modified/added yet? Is it
>> basically better support for runtime reflection?
>
> Basically I'm adding the necessary pieces so that DMD can generate
> object files containing the exact same things an the Objective-C
> compiler would generate. I am also adding the few necessary syntactic
> additions to support this. The end result should be as efficient as the
> Objective-C compiler itself.
>
> One thing I am *not* doing is adding the alien Objective-C syntax to D.
> Declaring an Objective-C class will look like this:
>
> extern (Objective-C)
> class NSObject {
> NSString description() @property;
> void perform(SEL selector, NSObject object) [performSelector:withObject:];
> }
>
> and for the most part should be semantically equivalent to a regular D
> class. The only cases where I'm adding to the syntax are those where
> special things need to be expressed, such as the Objective-C selector
> when necessary for one of the two methods above.
>
> Most of the work is being done in the glue code that links the frontend
> to the backend. I'm trying to not affect the semantics of any D
> construct, simply binding them to the Objective-C runtime where
> appropriate.

Sounds good, I also once thought about adding extern (Objective-C) to 
the language. About the selector syntax, wouldn't it be better to have 
the same syntax as in Objective-C, 
@selector(performSelector:withObject:). I mean D already has the 
@annotation syntax for annotations/attributes I don't think we need yet 
another one. I would also be nice to use 
@selector(performSelector:withObject:) as an expression (or what is 
called) to get the selector to a method just like in Objective-C.

Have you thought anything about the blocks that Apple added in Snow 
Leopard, if those could be supported as well?

What about Objective-C categories?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list