And one step further from @lucian's template, returning procs:
type
SomeObject*[T: SomeNumber] = object
val : T
#ex3
proc test3impl[T : SomeNumber]: SomeObject[T] =
# all actual code here
echo "type is " & $T
template test3*(T : typedesc[SomeNumber] = float) : untyped =
# a dispatcher: just calling the proc
test3impl[T]()
#doesn't work
#echo test3(pointer)
#works
echo test3()
echo test3(int)
echo test3(float)
echo test3(byte)
Run
- typedesc with subtype won't compile when returning objects vitreo12
- Re: typedesc with subtype won't compile when returning ob... GordonBGood
- Re: typedesc with subtype won't compile when returnin... vitreo12
- Re: typedesc with subtype won't compile when retu... lucian
- Re: typedesc with subtype won't compile when ... GordonBGood
- Re: typedesc with subtype won't compile ... LeuGim
