0

For example, if I write [self func] but I don't have a func defined within self, then the compiler will give an error that no such method exists. But shouldn't Objective-C check this during runtime? Then why would compiler give an error just during compiling time?
I've googled but haven't found any answer that exactly answer my question.

Leo
  • 492
  • 1
  • 5
  • 15
  • Because it's just so handy to find errors in your code quickly without having to run the code. – gnasher729 Aug 18 '16 at 13:35
  • But what if I'll add an implementation of `func` at runtime? – Leo Aug 18 '16 at 13:36
  • ARC decides what it needs to retain/release/autorelease based on the cocoa memory management conventions, which would suggest that knowing the selector's name is enough. – 酷酷的哀殿 Sep 25 '16 at 06:01

0 Answers0