D versus Objective C Comparison
John Reimer
terminal.node at gmail.com
Mon Feb 2 06:46:53 PST 2009
Hello Michel,
> On 2009-02-02 01:39:40 -0500, John Reimer <terminal.node at gmail.com>
> said:
>
>> "The Objective-C language defers as much as it can from compile time
>> and link time to runtime. Whenever possible, it does things
>> dynamically. This means that the language requires not just a
>> compiler, but also a runtime system to execute the compiled code.
>> The runtime system acts as a kind of operating system for the
>> Objective-C language; it's what makes the language work."
>>
>> This is actually kind of interesting because it would seem to make
>> Objective-C slightly comparable to the C# language in that it's more
>> than just a language (as is Java). It's a platform (and the beauty
>> of the platform is really only extensively demonstrated by the OS
>> runtime functionality that supports it ... and Cocoa).
>>
> Yeah, but the Objective-C runtime is pretty microscopic compared to
> Java or the C# runtime. There is no such thing as a virtual machine.
> What the Objecitve-C runtime does is this, and only this:
>
> 1. It manages a list of registered classes, and their associated
> methods.
> 2. It provides a method dispatch mechanism, and manages a list of
> registered selectors.
> 3. It provides various support routines for the compiler (exception
> handling, synchronization).
> For comparison, the D runtime does half of 1, and whole of 3, and a
> lot more. If you start counting parts of the Foundation framework in
> the runtime, then you'd have a base object class, an exception class,
> a thread class... But technically, Foundation is not part of the
> runtime, even if it's pretty necessary to do anything.
>
I see... But the dynamic binding part is part of one, I assume? That's a
pretty big (in terms of importance) feature that seems lacking in other runtimes?
I don't know if C# provides anything like it.
> I'd say that the Objective-C runtime is smaller than druntime since it
> does less (no TypeInfo, no array concat, no associative array, no
> thread support, etc.), although I haven't measured anything. On the
> other hand, the "standard library" (the Foundation framework) is
> probably bigger than both Phobos and Tango together.
>
Ok, thanks for the info. I think with Objective C, it's more about what
it achieves than how much. The Objective C people seem to make a fairly
big deal about how dynamic binding makes the language so much more flexible
than other languages (which probably is true) in this one regard.
-JJR
More information about the Digitalmars-d
mailing list