Thread overview
OT: Objective-C++
Re: Objective-C++
Mar 21, 2005
Ben Hinkle
March 20, 2005
In case anyone wonder what "Objective-C++" is,
it is the ultimate mongrel: the bastard child
of Objective-C and C++... Mostly useful for
writing wrappers to Objective-C system libraries
for use with C++ class libraries (on Mac OS X)

But you *could* write nice little programs like:

main.mm:
> #include <iostream>
> #import <Cocoa/Cocoa.h>
> using namespace std;
> int main()
> {
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> NSString *aString = [NSString stringWithString:@"Hello, World!"];
> cout << [aString cString] << endl;
> [pool release];
> return 0;
> }

Operative keyword here being "can", not "want" :-)

--anders

PS. There even seems to be a D project:
    http://www.dsource.org/projects/docoa/
    How about "Objective-D", anyone ? :-)

March 20, 2005
"Anders F Björklund" <afb@algonet.se> wrote in message news:d1kscp$1du7$1@digitaldaemon.com...
> main.mm:
>> #include <iostream>
>> #import <Cocoa/Cocoa.h>
>> using namespace std;
>> int main()
>> {
>> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>> NSString *aString = [NSString stringWithString:@"Hello, World!"];
>> cout << [aString cString] << endl;
>> [pool release];
>> return 0;
>> }

That's horrendous.  :)


March 21, 2005
"Anders F Björklund" <afb@algonet.se> wrote in message news:d1kscp$1du7$1@digitaldaemon.com...
> In case anyone wonder what "Objective-C++" is,
> it is the ultimate mongrel: the bastard child
> of Objective-C and C++... Mostly useful for
> writing wrappers to Objective-C system libraries
> for use with C++ class libraries (on Mac OS X)

Has Apple ever chosen the "right" language? Pascal... Object Pascal... Objective-C... maybe they are finally starting to come around. oh well :-P I just wish Dylan had worked out. Imagine a mainstream system API entirely in lisp - yikes.


March 21, 2005
Ben Hinkle wrote:

> Has Apple ever chosen the "right" language? Pascal... Object Pascal... Objective-C... maybe they are finally starting to come around. oh well :-P

Not really, just that market forces made them support C++ and Java.
The "preferred" language for all of NeXTStep is still Objective-C...


(there's also the procedural API, Carbon, but that is Pascal-inspired
C - not* C++, and there are of course the Java 1.4 JVM libraries too)

* Unless you count the MacApp class library as a "system" library ?
  http://developer.apple.com/tools/macapp/ (no longer supported)


Compared to ugly C++, Objective-C(++) is not that bad. But D is better
Mac OS X also runs that Java clone by that other Monopoly company. ;-)

--anders

PS. Follow the rest of the D-for-Mac discussion in the D.gnu newsgroup.