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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to