Re: Efficiently getting characters
Re: Efficiently getting characters
- Subject: Re: Efficiently getting characters
- From: Nir Soffer <email@hidden>
- Date: Wed, 3 May 2006 19:31:50 +0300
On 03/05/2006, at 18:44, Bill Bumgarner wrote:
The documentation is perfectly clear.
The documentation is clear and correct for those who want to subclass
NSString - but for most developers who just want to use a string it is
confusing.
"Abstract implementation" implies just that -- the implementation
provided is an abstract that behaves correctly but is not intended to
be a specific, concrete, implementation of the defined algorithm.
The documentation then goes on to say that subclasses should override
said implementation to provide an optimal implementation for the
purposes of the subclass.
When using an instance of a class -- a method of a class -- and, in
particular, when subclassing a class, it is critical that one reads
the class documentation itself.
Along with a discussion of concrete private subclasses, class
clusters, and other implementation details, the NSString documentation
further states:
Any subclass of NSString must override the primitive instance methods
length and characterAtIndex:. These methods must operate on the
backing store that you provide for the characters of the string. For
this backing store you can use a static array, a dynamically allocated
buffer, a standard NSString object, or some other data type or
mechanism. You may also choose to override, partially or fully, any
other NSString method for which you want to provide an alternative
implementation. For example, for better performance it is recommended
that you override getCharacters:range: and give it a faster
implementation.
All this is correct, but most users don't need this information.
Sub classing class clusters is very special task, it would be nice if
each class cluster had a chapter about sub classing, that list the
method that need to be overridden, and discuss specific issues with
each method.
Best Regards,
Nir Soffer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden