• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Lack of Initializers or Factory Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lack of Initializers or Factory Methods


  • Subject: Re: Lack of Initializers or Factory Methods
  • From: email@hidden
  • Date: Mon, 3 Nov 2008 16:39:03 +0000

Gordon Apple wrote on 03/11/2008 16:30:57:

>     Is "self" even defined for a class object?

Yes; in any method, self is (or at least starts life as) the object which
received the message.

> If so, should case 1 (or
> similar) be the assumed implementation for all of Cocoa?

I don't think that would work for class clusters. Consider +[NSArray
array]:

#import <Foundation/Foundation.h>

int main (int argc, char ** argv)
{
  id arp = [[NSAutoreleasePool alloc] init];
  id array = [NSArray array];
  NSLog(@"%@", NSStringFromClass([array class]));
  [arp release];
  return 0;
}

intel:trunk leeg$ ~/foo
2008-11-03 16:36:29.274 foo[14229:10b] NSCFArray

so it doesn't return the class in your case 1, which would be NSArray. It
doesn't return the class in your case 2 which would also be NSArray ;-).

> If not, then,
> IMHO, the docs in general should specify which is is for each factory
> method.
>

File bugs :-)

Cheers,
Graham.



--
Graham Lee
Senior Macintosh Software Engineer, Sophos

Tel: 01235 540266 (Direct)
Web: http://www.sophos.com
Sophos - Security and Control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Lack of Initializers or Factory Methods (From: Gordon Apple <email@hidden>)

  • Prev by Date: Re: Lack of Initializers or Factory Methods
  • Next by Date: Re: Lack of Initializers or Factory Methods
  • Previous by thread: Re: Lack of Initializers or Factory Methods
  • Next by thread: Re: Lack of Initializers or Factory Methods
  • Index(es):
    • Date
    • Thread