• 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: How far with accessors?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How far with accessors?


  • Subject: Re: How far with accessors?
  • From: The Amazing Llama <email@hidden>
  • Date: Wed, 26 May 2004 13:21:20 -0700

On May 26, 2004, at 11:51 AM, Don Rainwater wrote:
> How far should I go with using accessors to do things to instance
> variables? For example, say I have the following:
>
> @interface theRecord : NSObject {
> NSString *_theString;
> }
>
> #pragma mark -
> #pragma mark ACCESSORS
> - (NSString *)theString;
> - (void)setTheString:(NSString *)inValue;
>
> @end
>
> In the dealloc method for theRecord, is there any reason (standards,
> performance, personal preference, etc.) to use
>
> [[self theString] release];
>
> or is
>
> [_theString release];
>
> fine/preferred?

I've always used [self setTheString:nil], which should cascade to any
other objects that care about theString and its state. It's been very
helpful for me, but there are certain situations where it doesn't work
(like if the dependent objects have problems dealing with nil).

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >How far with accessors? (From: Don Rainwater <email@hidden>)

  • Prev by Date: "Manually" saving NSTableView info
  • Next by Date: NSTextView baseline for line of text
  • Previous by thread: Re: How far with accessors?
  • Next by thread: Fwd: How far with accessors?
  • Index(es):
    • Date
    • Thread