• 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: Accessor method article preview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor method article preview


  • Subject: Re: Accessor method article preview
  • From: Marcel Weiher <email@hidden>
  • Date: Thu, 27 Jun 2002 11:03:42 +0200

(Just catching up on my e-mail)

How about going a bit further and letting the Macro generate the entire method? In fact, why not let it generate both the getter and setter?

idAccessor( name, setName )

produces both the (trivial) get-accessor and the (not so trivial) set-accessor. See MPWFoundation.


On Thursday, June 13, 2002, at 05:41 Uhr, Edwin Zacharias wrote:

Thanks very much for the accolades, mmalc. Here's one quick tip that is probably beyond the scope of your article as it will just make things more complicated for new programmers.

All my setters look like this:

- (void)setName: (NSString *)name
{
SCSetObject( __name, name );
}

Nice and simple. Here's the define:

#define SCSetObject(oldObject, newObject) [ newObject retain ], [ oldObject release], oldObject = newObject;


I'm now able to make changes to all my setters system wide based on the stuff I learned in your article. I should have also created an SCGetObject define to use for getter methods, but I didn't think that far ahead.


--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.

  • Follow-Ups:
    • ARGH Re: Accessor method article preview
      • From: Finlay Dobbie <email@hidden>
    • Re: Accessor method article preview
      • From: Edwin Zacharias <email@hidden>
References: 
 >Re: Accessor method article preview (From: Edwin Zacharias <email@hidden>)

  • Prev by Date: Re: What's STILL wrong with "symbol" fonts?
  • Next by Date: Re: Parsing XML
  • Previous by thread: Re: Accessor method article preview
  • Next by thread: Re: Accessor method article preview
  • Index(es):
    • Date
    • Thread