On Sep 15, 2015, at 10:52 AM, Kyle Sluder < email@hidden> wrote:
Class<ProtocolX> really is a Class (instance of metaclass).
That seems to be true, based on a bit of testing I just did. But I don’t think a type like that makes sense, since it says that the metaclass implements the protocol, which isn’t true; the metaclass would have to implement the “meta-protocol”, and I don’t know if such an entity exists explicitly in Obj-C. (I can’t rely on analogy to Smalltalk-80 because Smalltalk didn’t have protocols.)
For example, if a Class implemented NSCoding that would imply the metaclass had methods like encodeWithCoder:, which isn’t true.
Check out UIAppearance.h; that's how containment-based appearance works. Hm, I don’t see anything related to metaclasses there, just protocols with class methods.
(To be honest, thinking about metaclasses too much makes my head hurt. There’s a really weird diagram of the class hierarchy in the flyleaf of the classic Smalltalk-80 “blue book” that ends with a strange loop into Object.metaclass. My co-workers and I used to have religious arguments about that diagram when I worked at Xerox.)
Anyway, we’re well into objc-language territory here and should probably stop now that Dave got his compiler warning resolved :)
—Jens |