• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strange XCode Warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange XCode Warning


  • Subject: Re: Strange XCode Warning
  • From: Kyle Sluder <email@hidden>
  • Date: Tue, 15 Sep 2015 14:45:46 -0500

On Tue, Sep 15, 2015, at 01:23 PM, Jens Alfke wrote:
>
> > 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.

Recall that class methods are simply instance methods on the metaclass.
So Class<SomeProto> makes a statement about what messages you can send
to the class: the ones that are prefixed with a + in the protocol
definition.

So while Class<NSCoding> isn't a useful type because NSCoding doesn't
define any class methods, Class<NSSecureCoding> is useful because it
tells you that the class object responds to
@selector(supportsSecureCoding).

>
> > 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.

See the type for the argument to +appearanceWhenContainedIn:. It's a
Class<UIAppearanceContainer>. Not an explicit mention of metaclasses,
but at least proof that we use the Class<SomeProto> syntax to refer to
classes, not instances.

--Kyle Sluder

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Strange XCode Warning
      • From: Dave <email@hidden>
References: 
 >Strange XCode Warning (From: Dave <email@hidden>)
 >Re: Strange XCode Warning (From: Jens Alfke <email@hidden>)
 >Re: Strange XCode Warning (From: Dave <email@hidden>)
 >Re: Strange XCode Warning (From: Dave <email@hidden>)
 >Re: Strange XCode Warning (From: Dave <email@hidden>)
 >Re: Strange XCode Warning (From: Jens Alfke <email@hidden>)
 >Re: Strange XCode Warning (From: Kyle Sluder <email@hidden>)
 >Re: Strange XCode Warning (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Strange XCode Warning
  • Next by Date: Re: Strange XCode Warning
  • Previous by thread: Re: Strange XCode Warning
  • Next by thread: Re: Strange XCode Warning
  • Index(es):
    • Date
    • Thread