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: Nicola Pero
Subject: Re: An alternative to the 'IMP prototype' approach
Date: Thu, 4 Sep 2003 17:54:12 +0100 (BST)

> 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.





reply via email to

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