• 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: What are the limitations of Dot Syntax?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What are the limitations of Dot Syntax?


  • Subject: Re: What are the limitations of Dot Syntax?
  • From: Jim Correia <email@hidden>
  • Date: Fri, 5 Dec 2008 23:06:31 -0500

On Dec 5, 2008, at 10:55 PM, Jerry Krinock wrote:

On 2008 Dec, 05, at 18:40, Chris Hanson wrote:

Dot syntax compiles to objc_msgSend* just like bracket syntax does. However, it must see either getter/setter declarations or an @property declaration to know what selector to put in the objc_msgSend* that it compiles to.

I understand why this must be so, but it makes the dot syntax difficult to use in practice. When writing a message, I have to stop and think, "Gee did I declare that as a property or not?" If I'm not sure, and have to click to my documentation, it's faster to just put in the square brackets.


Also, it seems to me that that dot syntax makes more fragile code. For example, say that I declare a 'name' property. Then, next week I decide that I need a more granular name, so replace this property with a firstName and lastName property, and a -name accessor which concatenates firstName and lastName.

Why would you refactor your code so that name is no longer a property?

Name is still a conceptually a property, but it is dependent on firstName and lastName, and read only now.

@property(nonatomic, copy) NSString *firstName;
@property(nonatomic, copy) NSString *lastName;

@property(nonatomic, readonly) NSString *name;  /* or fullName */

Jim
_______________________________________________

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: 
 >What are the limitations of Dot Syntax? (From: Jerry Krinock <email@hidden>)
 >Re: What are the limitations of Dot Syntax? (From: glenn andreas <email@hidden>)
 >Re: What are the limitations of Dot Syntax? (From: Jerry Krinock <email@hidden>)
 >Re: What are the limitations of Dot Syntax? (From: Chris Hanson <email@hidden>)
 >Re: What are the limitations of Dot Syntax? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: What are the limitations of Dot Syntax?
  • Next by Date: Re: What are the limitations of Dot Syntax?
  • Previous by thread: Re: What are the limitations of Dot Syntax?
  • Next by thread: Re: What are the limitations of Dot Syntax?
  • Index(es):
    • Date
    • Thread