[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

An alternative to the 'IMP prototype' approach

From: Ziemowit Laski
Subject: An alternative to the 'IMP prototype' approach
Date: Wed, 3 Sep 2003 17:50:33 -0700

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.

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.

Note that this should gracefully degrade to a 'IMP prototype' if
necessary.  Of course, if no method at all has been found, then
the IMP is all we have to begin with. :-)

Thoughts? :-)

Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

reply via email to

[Prev in Thread] Current Thread [Next in Thread]