[linux-audio-dev] Objective-C (was: gcc, you let me down...)

Tim Goetze tim at quitte.de
Mon Jun 6 10:51:13 UTC 2005


[Toby]
> I've recently been looking for an alternative *compiled* object-oriented
> language, because let's face it, Python is on average 10 times slower
> than C.  Sometimes you just can't afford it.

When speed becomes a crucial criterion, I usually switch to C++ 
extensions for Python. Easy to code, and works like a charm (until the 
next major gcc release that is :)

> Enter Objective-C:
>
> - STRICT SUPERSET OF C: every valid C program is a valid ObjC program.
>  This makes it trivial to include or link to C code and libraries and
>  to mix procedural, object-oriented and ASM code in the same *file*.
>
> - SIMPLE: ObjC is plain C with one syntax addition and a few new
>  keywords.  It only extends the C language to support Smalltalk-like
>  object-oriented features, because that's all you're going to need.
>  No more operator overloading, templates, references, 'const', etc.
>
> - DYNAMICALLY TYPED: messages (method calls) are delivered according to
>  the dynamic type of the target object, not to some static type.  This
>  is how Python works.  You can even send an object a message that is
>  not specified in its interface.  This might seem like a bad idea, but
>  instead it allows for powerful delegation-based design patterns.
>
> - FAST: Objective-C performs dynamically bound message calls very
>  quickly, about 1.5-2.0 times as long as a plain C function call!

Bringing very sophisticated high-level features to the table, Obj-C 
would have to replace both Python and C++ for me. I think that in 
comparison, Python's high-level features make it a fair bit easier to 
use and C++ has features I have grown addicted to (templates, 
overloading, namespaces).

So, that would mean giving up dear features for a reduction in 
language diversity. It might work out well, but a significant benefit 
of the Python/C++ combination that I have come to appreciate a lot is 
the clean and strict encapsulation of high- and low-level code that 
makes managing even a large project quite a painless experience.

Cheers, Tim



More information about the Linux-audio-dev mailing list