I don't see any use for it honestly, but heres one way you can do it
type Obj = object
proc fun(_: typedesc[Obj], x: int): int = x * 2
doAssert Obj.fun(4) == 8
Run
- How to write static function inside a type kcvinu
- Re: How to write static function inside a type Hlaaftana
