gnustep-dev
[Top][All Lists]
Advanced

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

Re: NSString changes breaks...


From: richard
Subject: Re: NSString changes breaks...
Date: Tue, 31 Oct 2000 17:35:08 +0000

On Tuesday, October 31, 2000, at 04:55 PM, address@hidden wrote:

> Hello, 
>  
> It seems that changes in NSString breaks GNUstepWeb.

They shouldn't have :-(

> There's a GSWElementIDString class which inherit from NSMutableString 
> Now, when we get this exception: 
>         subclass GSWElementIDString should override 
> initWithCharactersNoCopy:length: freeWhenDone: 

Well, that at least is reasonable - any subclass of a class cluster needs to 
implement
at least the primitive methods.  I have always assumed that primitive methods 
included designated
initialisers, but perhaps that is wrong.  I'd welcome opinions.

The -initWithCharactersNoCopy:length:freeWhenDone: is currently a primitive for 
NSString and 
-initWithCapacity: is primitive for NSMutableString, but I'm not sure if 
NSMutableString should
implement -initWithCharactersNoCopy:length:freeWhenDone: using 
-initWithCapacity: and -replaceCharactersInRange:withString:.  At present, it 
doesn't.

> GSWElementIDString doesn't have any ivar. It's just an empty class with a 
> category. 

If it has no ivars, how dis it expected to work?

> As far as I understand changes, NSMutableString seems to be now an empty 
> class too which 
> allocate a GSMStringClass.
Yes - but it's always been an empty (abstract) class that allocates another 
(concrete) class -
in that reespect it hasn't changed.

> So do I have to make GSWElementIDString inherit from 
> GSMStringClass (which seems to be a 'private' class) or is there a better 
> solution ? 

To subclass NSMutableString, you should be inheriting from NSMutableString and 
implementing
(at least) -replaceCharactersInRange:withString:, -length, -characterAtindex:

As the code stands now, you also have to implement the designated initialisers -
-initWithCharactersNoCopy:length:freeWhenDone:
-initWithCStringNoCopy:length:freeWhenDone:
-initWithCapacity:

Please could anyone with experience of subclassing class clusters in 
OPENSTEP/MacOS-X let me
know if the designated initialisers should need implementing too, or if I 
should change the
base library to quietly make them no-ops?




reply via email to

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