• 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: Obj-C question: protocol usage and inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C question: protocol usage and inheritance


  • Subject: Re: Obj-C question: protocol usage and inheritance
  • From: Nat! <email@hidden>
  • Date: Tue, 17 Sep 2002 23:44:15 +0200

Am Dienstag, 17.09.02 um 06:06 Uhr schrieb Nicola Pero:

On Mon, 16 Sep 2002, Normand Rivard wrote:

According to http://www.toodarkpark.org/computers/objc/moreobjc.html#787
(look for "Conforming to a Protocol"), "A class is said to conform to a
formal protocol if it adopts the protocol or inherits from a class that
adopts it. " This could mean that MySuperClass should also conform to
the protocol MyClassType to shut up the warnings. The problem is that in
general, it doesn't make sense (although it might in my specific case).

If someone from Apple from the compiler group can reply to this, I would
appreciate. My opinion is that a class should be said to conform to a
formal protocol if it adopts the protocol **by implementation or
inheritance** or inherits from a class that adopts it. I don't think it
would break any existing code if the compiler could be changed (fixed?)
to support that definition. Did I mention that even if I have warnings,
this code works perfectly well at run time?

Please read the documentation for the -Wno-protocol compiler switch.

But is it too much to ask from the compiler to look whether the "missing method" is declared in the superclass(es) before issueing the warning ? Although the compiler can not determine that such a method does not exist, the programmer can tell the compiler in the header of the superclass that such a method is supposed exist. That's what headers are for. Otherwise if the method is really not anywhere declared a warning can indeed by very helpful! Turning it off is not the optimal solution.

I suspect that fixing the compiler warning is fairly simple, as all the information (class hierarchy, implemented methods) should be available at compile time. (No I don't want to fix it :))

Nat!

Jedenfalls sind zehn Fehlstarts hintereinander [E. Fuchs]
ein sehr interessanter Beweis
fuer unsere Theorie
von der natuerlichen Ueberlegenheit des Dezimalsystems
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Obj-C question: protocol usage and inheritance
      • From: Nicola Pero <email@hidden>
  • Prev by Date: Re: Required Double Extensions in Save Panel
  • Next by Date: NSURL Blocking
  • Previous by thread: Re: Obj-C question: protocol usage and inheritance
  • Next by thread: Re: Obj-C question: protocol usage and inheritance
  • Index(es):
    • Date
    • Thread