• 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: glenn andreas <email@hidden>
  • Date: Fri, 05 Dec 2008 18:44:15 -0600


On Dec 5, 2008, at 6:32 PM, Jerry Krinock wrote:

I've been having some unexpected results trying to compile code using Objective-C's Dot Syntax. I realize that this may be due to an important question that I didn't find the answer to when I read about Objective-C 2.0 Properties is: Can you use the dot syntax for "regular" messages that take 0 arguments?
You can, but you shouldn't (it's considered "dot abuse")




But then, either of these do not compile:

   path = set.anyObject.path ;
   path = (set.anyObject).path ;

In either case,

error: request for member 'path' in something not a structure or union

Then why did it work fine when in url.path by itself?

Because anyObject returns id, and since there are no properties of id, you get an error.
When you did:
   url = set.anyObject ;
   path = url.path ;


url had an explicit type (NSURL *) which had a path property.



Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
JSXObjC | the easy way to unite JavaScript and Objective C




_______________________________________________

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

  • Prev by Date: Re: New to Cocoa and Objective C, and I need some basic pointers
  • Next by Date: Re: ICA Documentation issue
  • Previous by thread: What are the limitations of Dot Syntax?
  • Next by thread: Re: What are the limitations of Dot Syntax?
  • Index(es):
    • Date
    • Thread