I like the pattern. You probably already know it and just wanted to make the
example simple, but you can keep the ref version generic:
```Nim
proc new[T](typ:typedesc[T], name:string, age:int):ref T =
result.new()
result[] = typ.val(name, age)
```