This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Objective-C library
- From: Nicola Pero <nicola at brainstorm dot co dot uk>
- To: Andrew Duncan <aduncan at expertcity dot com>
- Cc: gcc at gnu dot org
- Date: Mon, 9 Sep 2002 08:44:27 +0100 (BST)
- Subject: Re: Objective-C library
> I'm writing a reference for O'Reilly about Objective-C, and want to
> provide some guidelines for using the root Object class that is part
> of the standard distribution. Some aspects of this class (in
> particular, archiving with TypedStreams) are obscure.
It looks like quite straightforward to me, but I've never tried using it
so I don't know if it works or not - I know of no users of that code, and
it might well be totally broken. Anyway it looks pretty clear - your
subclass needs to overwrite -read:, -write: to archive/dearchive its
instance variables. In archive.c are the basic functions to
archive/dearchive the various types of stuff. In objc/typedstream.h the
basic typed stream structure. You need to call super's at the beginning
of the overridden method. I can generate an example and provide it to
you. I can probably also fix libobjc if it turns out it doesn't work (on
ix86).
But ... but what I can't but ask myself is - why do you want to use that
instead of using gnustep-base's hyper-cool NSArchiver/NSCoder/NSSerializer
(and similar stuff), which is very well tested, documented, used by most
ObjC users, high perfoming, super cool API, etc ?
> Can you refer me to current or past maintainers of this body of code?
> Thanks for any advice you can provide.
A comment from the heart of a core ObjC lover - sorry if it ends up that
it's all obvious to you, but I can't refrain from it -
The root Object class and TypedStreams and all that stuff is used by a
very tiny minority of users ... the Swarm project is probably the only
large project building upon the bare libobjc. I suppose it's Ok to talk
very shortly about the Object class in an ObjC reference/manual - but I
wouldn't get as far as to talk about TypedStreams etc.
Most Objective-C users use the FoundationKit on MacOSX or gnustep-base (or
libFoundation) on everything else - which provide completely new (and more
powerful, and better IMO - the best base class libraries available on the
market IMO - only Java has something comparable) root classes and
functionalities, and provide complete non-gui class libraries.
If I were to start with ObjC, I don't think I would be interested in
learning about Objects and TypedStreams - which are very old and basically
obsolete - and programming using the bare libobjc takes a huge amount of
time.
To write a program using only the bare libobjc (that is, just Objects and
TypedStreams etc), you'd basically have to write your own
foundation/base/system class library (arrays, hashtables, memory
management, dates, sets, unicode strings, threads, ... classes) on top of
it. That's a *lot* of time, time you'd better spend on your project
instead of rewriting yet another set of system class libraries :-) [not to
talk of the fact that it will take a *long* time before your own system
class libraries can get to the performance, API cleaness and bug-freeness
of standard ones]
Objective-C is a very attractive language ... but without a
foundation/base class library, it becomes much less attractive, since you
have to rewrite everything from scratch each time. I'd better use Java
then.
So - I would talk about programming in ObjC using the bare libobjc only as
a side topic (or an 'advanced' topic). For normal users, you want to get
them straight into programming using gnustep-base (or libFoundation, or
Apple FoundationKit - they all have the same API).
If you are writing an ObjC reference, what you really want is a
gnustep-base (/OpenStep foundation) reference IMO.