Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: ARC: error: no known instance method for selector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC: error: no known instance method for selector



On Jul 25, 2012, at 8:08 AM, Andreas Grosam wrote:
> On 25.07.2012, at 16:49, Remy Demarest wrote:
>> Under ARC, the compiler needs to now exactly the kind of ownership the method returns. The default in this case is that the object is not owned by the caller, but in the actual declaration the object may be owned by the caller ("ns_returns_retained" attribute), conversely, you may have a owning method like newBar that returns a non-retained object ("ns_returns_not_retained" attribute), in the former case you get an  under-release in the latter you get an over-release, which is detrimental to ARC.
>>
>> To make ARC deterministic, the compiler has to assume a lot of things so certain behaviours that were okay before are made illegal in ARC to ensure that the behaviour is consistent.
>
>
> Why was it made an error? Couldn't the compiler guess a default ownership deduced from the method family, but still issuing a warning?
>
> Sure, this *could* lead to runtime errors, but those are "expected" when a warning is ignored.

Our reasoning was split about 50/50 between (1) needing to be more careful about types and ownership and (2) wanting to eliminate an embarrassing wart in the language (not being allowed to complain about completely unknown methods with anything more strenuous than a warning).  There is really no legitimate reason to call a method that's not even declared somewhere.  The ability to do this makes some really trivial bugs (e.g. typos in selectors) runtime failures instead of compile failures.  We have always warned about it.  Fix your code.

John.


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

This email sent to email@hidden

References: 
 >ARC: error: no known instance method for selector (From: Andreas Grosam <email@hidden>)
 >Re: ARC: error: no known instance method for selector (From: Remy Demarest <email@hidden>)
 >Re: ARC: error: no known instance method for selector (From: Andreas Grosam <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.