Is it possible to do something like this?
type X = object
x: uint
proc default*(T: typedesc[X]): X = X(x: 2)
when isMainModule:
var x: X
x.x += 1
echo(x.x) # prints 3 rather than 1
Run
- Overload system.default charlieH
