[Gd-hackers] gtk interface: shorten identifiers, ... ?

Mike Austin mike_ekim at yahoo.com
Tue Dec 5 07:45:16 CET 2006


Chris Page wrote:
> On Nov 28, 2006, at 13:18 PM, Andreas Bogk wrote:
> 
>> Now for a generic function, all methods of that function need to  
>> have congruent argument lists, which means: same number of parameters.
> 
> Minor clarification: The rules of congruency are more involved, of  
> course, but you should at least be aware that the basic rule is "same  
> number of *required* parameters".
> 
> I've often thought that we should consider either adding overloading-- 
> meaning that different numbers of required args would simply create  
> different generic functions with the same user-visible name--or allow  
> methods to require different numbers of required args as long as they  
> require at least as many as the generic function, which must accept  
> #rest, e.g.:
> 
>    define generic foo(req1, req2, #rest optional);
>    define method  foo(req1, req2, #rest optional) ... end;
>    define method  foo(req1, req2, req3, #rest optional) ... end;
>    define method  foo(req1, req2, req3, req4, #rest optional) ... end;
> 
> These would be considered congruent and the number of arguments  
> passed in would be considered when dispatching.

The first option sounds pretty nifty.  I guess it could get tricky with keyword 
and rest args, but I don't know the internals of the Dylan runtimes.


Mike




More information about the hackers mailing list