I see that falling back to the 'IMP prototype' during message
dispatching
has caused quite a bit of grief :-) :-) At the same time, I still
abhor
the notion of the compiler choosing method signatures at random,
either
initially or as a last resort.
It need not be random. It might be that the compiler deterministically
and consistently uses 'the last declaration seen of a method with that
name'. This is random in the sense that there is no obvious rationale
behind this choice except the fact that the last seen declaration is
chosen, but ...
So perhaps we can we do the following when examining multiple method
signatures:
- Examine the return types for all the methods; if all of them
(after int-promotion, perhaps?) are exactly the same, use that
type;
otherwise, use 'id'
- For each argument (past the implied 'id, SEL'):
- If the same for all methods, use that type and advance to
the next argument;
- Otherwise, use '...' and stop.
We'd then change the warning message to tell the user the method
signature
that we concocted for him.
... but there is no obvious rationale behind your proposed choice
either,
actually you could argue that your proposed choice will generate much
more
random and unexpected (and unlikely to work) method prototypes than
just
using the last prototype seen for that selector.