Skip navigation.
 
mlRe: numberWithInt (was Re: NSForm validation)
FROM : Andy Lee
DATE : Wed Nov 13 20:08:03 2002

At 7:34 PM -0500 11/13/02, Cameron Hayne wrote:
>what is missing is the documentation. The behaviour seems to be an
>unstated convention rather than something that is necessarily true.
>Even using AppKiDo I fail to see anything that says that the method
>numberWithInt that NSDecimalNumber inherits from NSNumber returns an
>NSDecimalNumber.


I've only been skimming this thread, but for some reason when I saw
AppKiDo mentioned, I found it more interesting. ;)

I agree that the classes of objects returned by instantiators should
be better documented, especially since they usually return id's.  For
example, the doc for [NSArray +arrayWithObjects:] says:

    Creates and returns an array containing the
    objects in the argument list.

At the very least, they could have said

    Creates and returns an instance of the receiver
    containing the objects in the argument list.

They could have gone a bit further and added:

    The returned array is an instance of the class
    object that received the message.  For example,
    [NSMutableArray arrayWithObjects:...] returns a
    mutable array.

Even if the convention is documented elsewhere, IMO it's worth adding
these few words to the individual method docs.

This discussion has inspired me to file a bug on this.  The Problem
ID# is 3100874.

--Andy

Related mailsAuthorDate
mlNSForm validation James Powell Nov 12, 22:40
mlRe: NSForm validation James Powell Nov 13, 11:31
mlRe: NSForm validation Andreas Mayer Nov 13, 13:23
mlRe: NSForm validation James Powell Nov 13, 14:09
mlRe: NSForm validation Andreas Mayer Nov 13, 15:49
mlRe: numberWithInt (was Re: NSForm validation) Cameron Hayne Nov 13, 16:35
mlRe: numberWithInt (was Re: NSForm validation) Jeff Disher Nov 13, 16:52
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:16
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:45
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:53
mlRe: numberWithInt (was Re: NSForm validation) James Powell Nov 13, 18:11
mlRe: numberWithInt (was Re: NSForm validation) Andy Lee Nov 13, 20:08
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 14, 06:49
mlRe: numberWithInt (was Re: NSForm validation) Andy Lee Nov 14, 08:30
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 14, 13:17