Xcode 4/LLVM 3.0 — make it a little smarter about “no known instance method for selector” errors?

That expression is only perfectly safe" if there are no arguments and no return value. If any type information is required selector(foo) is insufficient.

If (self respondsToSelector: @selector(foo)) self foo; That expression is only "perfectly safe" if there are no arguments and no return value. If any type information is required, @selector(foo) is insufficient. Even then, I suspect that there are architectures whose ABI are such that the no-arg-no-return case would actually require that type knowledge be available to the compiler to be able to generate code that is absolutely guaranteed correct.

That is to say, your example of fooWithInteger: and/or fooWithX:y:z: could not possibly be compiled correctly without the full type information available due to the vagaries of the C language and the architecture specific ABI. As well, to allow the compiler to compile that without warning would require the compiler to collude a runtime expression -- respondsToSelector: must be dynamically dispatched -- with a compile time expression. Compilers hate that.

To silence the compiler when following that kind of pattern, I use -performSelector: if (self respondsToSelector:@selector(foo)) { self performSelector:@selector(foo); } I don't know of any other way.

Ugh, could be problematic if what I really want to do is self fooWithInteger: 2; . . .

Or, much worse, self fooWithX: 1 y: 2 z: 3; – William Jockusch Aug 3 at 2:22 @William: Indeed. I've avoided similar method signatures for that very reason. I find situations where I need to conditionally send messages based on responsiveness rare though, so it hasn't bugged me enough to explore other options.

Just my two cents. – Matt Wilding Aug 3 at 2:24 @WilliamJockusch: you can use NSInvocation to do that. – Andrey Z Nov 21 at 9:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions