Thanks for the answer. I tried your example and it indeed works, even though I
would prefer the simpler syntax of `T : typedesc[SomeNumber] = typedesc[float]`
to work. In any case, I also came across this other error, when trying to limit
the `T` inside the `SomeObject` definition:
type
SomeObject[T : SomeNumber] = object
val: T
#ex3
proc test3(T: typedesc = typedesc[float]) : SomeObject[T] =
when T isnot SomeNumber: {.fatal: "type must be SomeNumber!!!".}
echo "type is ", $T
#doesn't work
test3()
Run
The error is:
Error: cannot instantiate SomeObject
got: <typedesc>
but expected: <T: SomeNumber>
Run
It appears that typedesc would not work with any `T : Something` in an object
definition.