Re: How do I get access to the control within a NSToolbarItem?
Re: How do I get access to the control within a NSToolbarItem?
- Subject: Re: How do I get access to the control within a NSToolbarItem?
- From: Jens Alfke <email@hidden>
- Date: Sun, 03 Aug 2014 16:19:18 -0700
> On Aug 3, 2014, at 1:12 PM, Daryle Walker <email@hidden> wrote:
>
> I thought the compiler will ignore that fact with a warning instead of an error.
It used to be a warning (which I always thought was letting people off too lightly) but I believe with ARC it’s become an error.
> Is this something reserved only when using “id” as the static-time pointer type?
Yes, ‘id’ is like ‘void*’ in C — it can be assigned to or from any other object reference type without needing a cast. (In the very first version of Objective-C, ‘id’ was the only object reference type, and there was no compile-time type checking of messages at all. Obj-C was strongly inspired by Smalltalk-80, which is dynamically typed. NeXT added the static typing somewhat later on, maybe around 1990 or so.)
It’s the same operation either way. In my opinion it’s _less_ hacky now that it requires an explicit cast, because it makes it clearer that your’e down-casting* and what you expect the receiver’s type to be.
—Jens
* https://en.wikipedia.org/wiki/Downcasting
_______________________________________________
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