Yes, 'any' is a generic (typeclass). Your object should probably be defined 
like this 
    
    
    type item[T] = object
      value: T
      next: ptr item[T]
    

Likewise '<' is an overloaded proc, so not a specific proc that you can pass to 
a function. Also, you don't need to specify 'ptr' for a proc when used as an 
argument, Nim will implicitly do the right thing for the corresponding backend. 
You can wrap overloaded functions in a specific one if you want to pass them 
    
    
    proc a(p: proc) =
      var x,y: int
      echo p(x,y)
    
    proc lt(x,y: int): bool =
      x < y
    
    a(lt)
    

or you can use a template to generate separate functions for each proc you want 
passed in. This can then handle overload procs. 
    
    
    template makeproc(f,p: untyped): untyped =
      proc f =
        var x,y: int
        echo p(x,y)
    
    makeproc(b, `<`)
    b()
    

Reply via email to