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 17:29:07 +0200

Hi,

Dirk Theisen wrote:
> 
> Hi, Stefan!
> 
> > This is fine for local objects but not for distant objects. That was
> > the reason for suggesting this method.
> 
> I don't really understand the problem:
> 
> On my OS X box
> 
> NSLog(@"Classname: %@", [[NSString class] description]);
> 
> prints out:
> 
> Classname: NSString
> 
> I see nothing missing.
> 

Is it guaranteed, that [class description] will *allways* return the class
name? If it returns class name for each class from the foundation or appkit
that does not mean, that it will do it everywhere. The method is not designed
to return name of a class, but some kind of description of the receiver. For
example in the description can be included list of class-related variables. 

>From the Apple's Cocoa documentation:

<quote>

+ (NSString *)description

Returns an NSString that represents the contents of the receiving class. The
debugger's print-object command invokes this method to produce a textual
description of an object.

NSObject's implementation of this method simply prints the name of the class.

</quote>


One problem is that 'description' is not guaranteed to return the class name.
And another is that it does not work for distant objects, as I have described
in the previous mail.

Stefan



reply via email to

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