You can use closures (or just intermediate procs w/o outer variables capturing) to bind specific method or specific overloaded procedure version and some arguments (partial evaluation):
type
Obj = ref object of RootObj
Obj2 = ref object of Obj
method m(x: Obj, n: int) {.base.} = echo "Obj " & $n
method m(x: Obj2, n: int) = echo "Obj2 " & $n
proc callTwice(x: Obj, p: proc(x: Obj)) = p x; p x
var x: Obj
x = new Obj2
callTwice(x, proc(x: Obj) = m x, 7) # Obj2 7; Obj2 7
For simple cases just use the routine's name to pass it:
var y = new Obj
proc p(x: Obj) = echo "p"
y.p # => p
callTwice y, p # => p; p
nim
proc callTwice( p: proc())
what if param as p: proc(), how to pass the methodhttps://github.com/bung87/daemon/blob/fb0099dbb8b1927a9d4cc259323d1b9d4124e470/src/daemonim.nim#L140
the commented line I was trying to , and now I using generic proc ,store param global, since I tried many time...