> Why should it be surprising? Procedure calls and field accesses in generics 
> aren't resolved until instantiation time.

Yes, you may know that from other languages, I can not remember reading it in 
the Nim docs. I saw a hint in Tables module defining a custom hash proc, but 
until today I thought that that works only because table module uses templates. 
The question was, if the wuff() proc in my example can be inlined from the 
compiler.

> Looking at the algorithm module's sort procedure,

Some months ago I tested a quicksort proc, and found out that giving a cmp() 
proc for custom types decreases performance by about 25 percent compared to 
using a default cmp proc for known standard types. I tested that of course for 
the same data types like int. And the result did not surprised me that time, 
because the cmp() proc parameter is called often and is not inlined. My 
conclusion was, that it may make sense to provide a sort proc for arbitrary 
custom types with cmp() proc parameter, and additional procs for basic data 
types like int which do not need a cmp() proc parameter.

Reply via email to