discuss-gnustep
[Top][All Lists]
Advanced

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

Re: An alternative to the 'IMP prototype' approach


From: Ziemowit Laski
Subject: Re: An alternative to the 'IMP prototype' approach
Date: Thu, 4 Sep 2003 17:05:39 -0700


On Thursday, Sep 4, 2003, at 09:54 US/Pacific, Nicola Pero wrote:


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.

Hmmm.... perhaps. :-)
--------------------------------------------------------------
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]