Re: why isn't id<MyCellDelegate> an id?
Re: why isn't id<MyCellDelegate> an id?
- Subject: Re: why isn't id<MyCellDelegate> an id?
- From: Jens Alfke <email@hidden>
- Date: Fri, 04 Oct 2013 14:18:06 -0700
On Oct 4, 2013, at 11:30 AM, Tom Davie <email@hidden> wrote:
> The more mathematically correct thing to do (and what it does for all other types) is “I don’t know what it is, so I can’t ‘prove’* anything at all about whether this is correct, therefore it’s not correct. Puny human, you must provide me with more information to make proofs”.
It’s only mathematically correct if you are talking about a strong type system as in C++/Java/Haskell/etc. But Objective-C has a mixture of strong and dynamic typing, and in fact the dynamic typing is older: in the original Objective-C language the only object reference type was ‘id’, and typed object pointers were added later. IMHO the mixture of static and dynamic typing is very useful; most of the time you get good compile-time checking, and the exceptions to that are to avoid the kind of rat-holing into parameterized types that adds so much complexity to C++.
(Or if you want to think about it in non-OOP terms, ‘id’ is the Obj-C equivalent of C’s ‘void*’, but not C++’s ‘void*’.)
tl;dr: Both static and dynamic typing are valid language designs, and both are extremely popular. One is not more “correct” than the other.
—Jens
_______________________________________________
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