D/Objective-C Preliminary Design

Michel Fortin michel.fortin at michelf.com
Thu Nov 4 05:20:14 PDT 2010


On 2010-11-03 20:51:00 -0400, Walter Bright <newshound2 at digitalmars.com> said:

> Michel Fortin wrote:
>> You heard that right: someone is considering writing Cocoa programs 
>> because of D!
> 
> That's great news!
> 
>> I think we should try to attract Cocoa programmers (and would-be Cocoa 
>> programmers) by offering them the strengths of D. What are those 
>> strengths? Some are things you probably take for given (overloading), 
>> others are design by contract, generic programming, nested classes, 
>> mixins, integrated unittests and documentation, memory safety, a 
>> race-free threading model, did I miss anything? All those good things 
>> aren't available in Objective-C and thus can't be used with Cocoa. I 
>> want to make those them available to Cocoa programmers. And for this, I 
>> need them to work with the Objective-C object model. By making 
>> Objective-C objects bind to D semantics, all those feature will "just 
>> work" with Cocoa with minimal changes to the frontend (and well written 
>> bindings).
> 
> I don't know O-C. I've never written a line of it. So I'm shooting in 
> the dark about the best way to attach it to D.
> 
> I agree with all your goals.
> 
> One possibility: simply adopt O-C syntax.

That indeed could work. There's effectively a case to be made that we 
could integrate Objective-C in D the same way it is integrated with C++ 
with Objective-C++ (two distinct syntaxes for two distinct object 
models). Existing Objective-C programmers will probably be more 
familiar with code written this way so there's no doubt some people 
would prefer that.

But there's also a lot of Cocoa programmers that would prefer a more 
"conventional" syntax and D could be very appealing to them. I'm not 
one of those as I'm quite fond of the long and expressive method names 
in Objective-C, but I still think it's a bad fit for D because it gets 
in the way of bringing those interesting D features to Cocoa.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list