discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObject className


From: Stefan Urbanek
Subject: Re: NSObject className
Date: Sat, 08 Jun 2002 11:56:14 +0200

Richard Frith-Macdonald wrote:
> 
> On Friday, June 7, 2002, at 02:09 PM, Stefan Urbanek wrote:
> 
> > This method is missing in NSObject:
> >
> > - (NSString *) className
> > {
> >   return NSStringFromClass([self class]);
> > }
> 
> I'm not sure about this ... it's part of the new Apple scripting
> extensions,
> and I decided a while back not to implement the scripting extensions:
> 
> We already have scripting solutions which are arguably better than
> Apples stuff.
> Most (though not all) of the scripting extensions are pretty much
> useless for
> anything else.
> The scripting extensions are therefore just bloat - and I'm trying to
> *remove*
> bloat from the base library, not add it!
> 

I agree with not bloating. On the other hand, I think, this small method can
be quite useful not only in scripting. I know, that there are many small
methods that can be useful...and here comes the bloat...but this is what
discussion is good for.

> This does seem to be the opposite of Apples approach where, as well as
> adding
> new frameworks and some good APIs, they seem to be bloating existing
> APIs rather
> than attempting to keep them clean/simple :-(

My opinion on this is, that apple added scripting to the foundation framework
to make apple scripting 'the single prefered option'.

> I guess that's proof that the NeXT software developers are not
> completely in
> control at Apple.
> 
> If people want to use apple scripting in apps they port from MacOS-X to
> GNUstep,
> it would make sense for them to contribute the full set of apple
> scripting extensions
> as a subproject that can optionally be built as part of the base library
> or as a
> separate scripting library.  I'd undertake to maintain such a subproject.
> 
> That being said ... the -className method does not depend on the
> availability of
> the other extensions to be used.
> Perhaps we *should* build it in to the base library even through there
> are already
> two other methods of getting the class name -
> 
> name = NSStringFromClass([anObject class]);
> 

This is fine for local objects but not for distant objects. That was the
reason for suggesting this method.

> name = [[anObject class] description];

This is ok for all GNUstep classes, but this method does not have to return
class name. This method is used as debugging method for description of the
object and may contain more than a class name. And this also can not be used
to get the name of a class of a distant object. 
[[distantObject class] description] is @"NSDistantObject" and not the name of
the distant object's class.

Stefan

PS: Speaking about adding things to the base library, I have just noticed,
that Apple has moved spell-checking service from the AppKit to the Foundation.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]