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: Jerry Krinock <email@hidden>
- Date: Fri, 5 Dec 2008 17:24:09 -0800
On 2008 Dec, 05, at 16:44, glenn andreas wrote:
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")
Thanks for the quick answer to Glenn and Bill. So now, knowing what
was legal, I was able to compile the following using "as many dots as
legally possible":
NSString* name = ((Bird*)[foo.bar.birds anyObject]).name ;
where
bar is an @property Bar* of Foo
birds is an @property NSSet* of Bar
name is an @property NSString* of Bird
Interestingly, it will not compile without the (Bird*) typecast.
So I filed two bugs on gcc/Xcode:
6423994: Editor does not line up colons in Obj-C messages also using
Dot Syntax
6424037: Error message does not know about Obj-C 2.0 Properties
Jerry
_______________________________________________
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