• 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: Bill Bumgarner <email@hidden>
  • Date: Fri, 05 Dec 2008 20:06:43 -0800

On Dec 5, 2008, at 7:55 PM, Jerry Krinock wrote:
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.

No -- the dot syntax is 100% orthogonal to the @property syntax. Entirely independent of each other.


The only requirement of the . syntax is that the type -- the class -- of the object on the left side of the . must be known and must contain a declaration specifying the type to be set or returned, either through @property or through traditional method declarations.

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.

If I had accessed 'name' in other files using the square bracket syntax, everything is still OK. But if I had accessed it using the dot syntax, I now have dot abuse.

Not really. 'name' is still something that is an accessor type thing, regardless of whether it is derived or declared via @property()


"dot abuse" refers to expressions like:

foo.retain;
bar.lockFocusIfCanDraw;

That is, expressions where you aren't really asking the object to retrieve some value, but are more or less telling the object to do something and return a result.

And, yes, there are grey areas.

b.bum

_______________________________________________

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


  • Follow-Ups:
    • Re: What are the limitations of Dot Syntax?
      • From: Charles Srstka <email@hidden>
    • Re: What are the limitations of Dot Syntax?
      • From: Jerry Krinock <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: Asynchronous timers (without a run loop)
  • 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