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

Chris Page chris at chris-page.org
Mon Dec 4 01:40:57 CET 2006


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.

-- 
Chris Page - Rhetor

   Statements are closer than they appear.





More information about the hackers mailing list