Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!news.mathworks.com!fu-berlin.de!news.belwue.de!bias.ipc.uni-tuebingen.de!seicom.de!flop.schwaben.de!news
From: hhoff@schwaben.de (Holger Hoffstaette)
Subject: Re: Objective C++ VS SmallTalk- similar or disimilar? (LONG (but good :-))
X-Nntp-Posting-Host: flop
Message-ID: <DxIu3t.2x5@flop.schwaben.de>
Sender: news@flop.schwaben.de
Organization: home
X-Newsreader: RadicalNews (TM) 0.8.8 Beta(i)
References: <322F5367.3DAF@rs6000.cmp.ilstu.edu> <50q4rh$jng@freeside.cls.de> 
	<323215AF.4AEA@erols.com> 
Date: Tue, 10 Sep 1996 14:40:41 GMT
Lines: 146


Sorry, a little late..

 Luther Hampton wrote:
> Stefan Matthias Aust wrote:
> > 
> > >Can anyone tell me how similar or disimilar Objective C++ is compared
> > >with SmallTalk?
> > 
> > Objective C++? I only know Objective C (without ++). It was designed by
> > Brad J. Cox to show that object-oriented concepts can be included in every
> > programming language -- even in C :-) So the basic concepts are very

It's very much possible in Assembler, too..but Oh doctor, it hurts.. :)

On Objective-C++: it's an extended version of both the ObjC and C++ engines 
available in GNU gcc. Quoted from the NeXT Developer documentation:

Writing Mixed Code

NeXT's C++ compiler allows C++ and Objective C expressions to be mixed in 
almost any manner.  For example, Objective C messages can be sent within the 
member functions of C++ classes, and C++ member functions can be called within 
Objective C methods.  Objects defined in either language can create and use 
objects defined in the other language; a C++ class can declare an id as a data 
member, while an Objective C class can declare a C++ object as an instance 
variable.  An Objective C message can pass a C++ object as an argument, and a 
C++ function can take an Objective C object as an argument.

However, classes defined in each languages retain their own character.  You 
can't define an hybrid object.  Objective C messages can be sent only to 
Objective C receivers, and C++ member functions are called only through C++ 
objects.  A class defined in one language can't inherit from a class defined in 
the other language.  Moreover, operators specific to C++ can't be applied to 
Objective C objects.  It won't work, for example, to use the C++ new and delete 
operators to allocate and free Objective C objects.

When mixing C++ and Objective C code, the keywords of both languages should be 
respected.  In most cases, there's no problem since both languages derive from 
C and most keywords are shared.  However, the C++ keyword new is also a common 
method name in Objective C.  To handle this potential conflict, the compiler 
allows an Objective C method to have the same name as a C++ keyword and decides 
which is which based on context.  For example, if new appears outside square 
brackets, it's treated as the C++ keyword for allocation from the free store; 
if it appears within square brackets in the position of a message name, it's 
treated as such.  It's even legal to use new within a message expression as a 
C++ keyword:

[anObject useCPlusPlusObject:new cPlusPlusClass];

Since this style of code can be hard to read, it's not recommended that you use 
it.  

..etc..


> > similar to Smalltalk. However, Objective C isn't a pure o-o language but

Ooh, the 'p' word. What's pure? Everything is an object? I wonder where all the 
little VM primitives come from. :-)

> > there're still data types as integer or char. There're still normal
> > functions and control flow is implemented with statements, not with the
> > general message sending principle as in Smalltalk. I'm unsure whether block

It *can* be done this way. I can write a completely message-driven ObjC 
application, too. Your choice.

> > closures are possible in current Objective C implementations.

No. I think someone was working on blocks, but it's not in the base
language. Might be a difficult thing to do  right with recursions, exception 
handling, stack unwinding and everything..

> > Because of this restrictions, the basic class library hasn't the full
> > flexibility like the Smalltalk library. Objective C is a statically
> > compiled language, based on source code files. Smalltalk is an interpreted
> > or often incremental (aka dynamically) compiled system where methods are
> > the smallest piece of code. Smalltalk's integrated development environment,

ObjC has built-in run-time loading of code fragments - these can be
single methods, collections of methods or whole frameworks.
Just Do It.

> > especially the debugger is unique and unavailable in Objective C (afaIk).

Unfortunately correct. Smalltalk debuggers still rule supreme.

> > Objective C has introduced some nice features like interfaces, which are
> > now also part of Java. I don't like the syntax of Objective C's class and
> > method definitions very much, but with the right tools, this isn't probably
> > a problem.

What is it that you don't like? The syntax or anything about how the 
declaration words? I find it *much* better than C++ (big surprise :) because of 
the real separation of @interface and @implementation.

> > Stefan Matthias Aust // ...come on, kiss the frog

> What Stefan said is correct, but he left out any mention of 
> Nextstep. Objective-C by itself is an interesting language, 
> but without Nextstep development support I can't imagine 
> anyone getting anything done in it. Nextstep provides a very 

That's not exactly true. NEXTSTEP is only an OS with a commercial ObjC 
framework and lots of stuff around it. I used the free GNU gcc and learned 
Objective-C on my Amiga, used it on several UNIXes and it is already on NT, 
too. It runs on almost every platform that gcc runs on. Portably. Right now I'm 
developing web apps on my NEXTSTEP PC and simply recompile on Solaris. Works 
fine.

[more NEXT info snipped, part of which was wrong and/or outdated; this is not 
the place to discuss this. Send me mail or come over to comp.sys.next.advocacy 
:-)]

> not. Objective-C is another attempt to shoehorn object 
> qualities onto a less than object based language, i.e., C.  

Whoa, chill. I would certainly like to hear your opinion on C++. ObjC is *by 
far* easier to learn, develop in, and much more maintainable. Not bad when you 
consider it has been around the same time like C++, but ignored mostly because 
of ignorance and for FUD reasons. But since this is comp.lang.smalltalk I feel 
like preaching to the converted.. :-)

> Worse, Objective-C attempts to implement dynamic binding 
> while continuing to be based on the statically bound gnu C 

'Attempts'? Do you want to imply that it fails? If so, how?

> Objective-C is a Smalltalk wannabee and I advise my clients 
> to chuck the whole C thing and take the Smalltalk plunge, but 
> many won't, and Objective-C has very enthusiastic support 
> from the CIO levels of several of my clients.  If those guys 
> want it, it doesn't matter what's right.

Seems you're blessed with smart CIOs. ;)


Regards

Holger
--
ObjectWeb Weaver         | @work: hhoff@modern-video.de
Modern Video media group | @home: hhoff@schwaben.de (NeXTmail & PGP ok)
Stuttgart, Germany       | Be cool.

