Michel Fortin wrote:
> On 2009-01-31 18:50:52 -0500, Walter Bright <newshou...@digitalmars.com>
> said:
> 
>> Michel Fortin wrote:
>>> One area I think Objective-C to be very great and that you haven't
>>> touched is for creating stable APIs. In Objective-C, contrary to D
>>> and C++, you don't have to recompile every dependency when
>>> reordering, adding and removing member functions in a class. In
>>> 64-bit Objective-C 2.0, you can even add variables to a class without
>>> care about recompiling derived classes. Compare that to D, where
>>> exposing a class as a public API will either force you to not change
>>> much that class, or force your users to recompile every time you make
>>> such a change.
>>
>> If you use interfaces, you can add member fields without needing to
>> recompile clients.
> 
> Yeah, indeed. I hadn't thought about that. That's a pretty interesting
> thing about interfaces now that you make me think about it.
> 
> But exposing only interfaces makes the API harder to use. In Cocoa,
> classes gain new methods at each new version of the framework (read each
> version of Mac OS X) and it doesn't hinder programs compiled with
> earlier versions of the framework.
> 
> If you had a smart enough dynamic linker and the signature of each
> function in the virtual table, you could do that in D too by creating
> virtual tables and updating offsets in the code accordingly while
> linking. (Objective-C doesn't work like that, but it has the same
> effect.) Alternativly, it could be done in some static initialisation
> phase.

Visual Basic (not this .NET malarkey) solved this problem by having a
little checkbox in the project options labelled something like "Enable
Binary Compatibility."  Basically, when you compiled, it looked at the
previous version of your library, and made sure that any new methods
you'd added didn't stomp all over the old ones.

  -- Daniel

Reply via email to