• 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: clarification regarding properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clarification regarding properties


  • Subject: Re: clarification regarding properties
  • From: Alexander Spohr <email@hidden>
  • Date: Fri, 27 Mar 2009 18:11:17 +0100


Am 27.03.2009 um 17:24 schrieb WT:

foo = whatever
just sets the value of foo to the value of whatever, but
self.foo = whatever
actually calls the method setFoo: with whatever as its argument.

Yes.

If it is, this would be a major gotcha for Java developers new to Obj-C. In Java, this.foo = whatever has the exact same effect as foo = whatever when foo is a member variable of some object

Yes.

Also, this means that it's best *always* to use the qualified assignment for properties,

Yes. Or you could just call [self setFoo:whatever] which is what everyone did before ObjC 2.0 anyway.


since there's a chance that a property might be changed from assigned to retained or copied (or from nonatomic to "atomic").

You mean if someone changes the header-file? Yes.

The new property assignment syntax is an easy way to get mixed up between Java, C++ and ObjC 2.0. It was a syntax error before.

Just always use self.foo anywhere if foo is a property and never think about it again :)

	atze


_______________________________________________

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: 
 >clarification regarding properties (From: WT <email@hidden>)

  • Prev by Date: Re: Processing data maintained with Core Data
  • Next by Date: Re: several windows in a NIB ?
  • Previous by thread: Re: clarification regarding properties
  • Next by thread: Re: clarification regarding properties
  • Index(es):
    • Date
    • Thread