Re: [code] stuff

From: Thomas Katzlberger (katzlbt@vuse.vanderbilt.edu)
Date: 10/25/96


You wrote:
> On Fri, 25 Oct 1996, Mark Crichton wrote:
> > Actually, my original idea was based (I think) off a Dr. Dobbs
> > article about a C++ method of something Objective-C had, and that
> > was functions that had many different parameter sets, and that
> > ObjC took care of this automagically. (It went WELL beyond C++'s
> > overloading....)
> 
> I looked into Objective-C, but I didn't really buy why you'd want
> to use Objective-C over C++.

IMO Objective-C is the better language than C++ out of following reasons:

1.) full dynamic binding (not with virtual tables that change if your
header file changes).
2.) self documenting (as close as you can get right now)
3.) control over when you want to call the superclass constructor
and moreover you can call multiple constructors (of the same class) 
without problem without writing a wrapper function. 
4.) Generic object type id (like java) - You can make an array of
id's and put virtually any objects into it without ever worrying that
the system will call the wrong method or crash (like C++ does) see 1.)
5.) forwarding: you can forward (selected) messages to embedded objects
getting the same result as multiple inheritance, but with full control
(at runtime) over it.
6.) ...

> > (I also have the layout, also from Dr. Dobbs, for a C++ socket
> > handler, so you can do:
> > ch >> "Hello there" >>(Sock) 
> > and it'll print "Hello there" to the ch socket. Problem is that I
> > dont think the socket clode is non-blocking *sigh*)
> 
> I do it more like
> 
> ch << "Hello there" << endl;

I don't like these ostreams they make the programs completely
unreadable. My preferred version is:

sprintf(buf,"A %s%s%s is %s wrong.\n",CCYN(ch,foo),a,CNRM(ch,foo),b);
ch->print(buf);

not the more complicated, unreadable statement:

ch << "A " << CCYN(ch,foo) <<  a << CNRM(ch,foo) << " is " << b << " wrong." << endl;

Cat.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST