Re: What are the limitations of Dot Syntax?
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