My take at limiting the `T` inside the `SomeObject` definition
    
    
    type
        SomeObject[T : SomeNumber] = object
          val: T
    
    #ex3
    template test3(typ: typedesc = float) : untyped =
        echo "type is ", $typ
        let res = 10.typ
        SomeObject[typ](val: res)
    
    #doesn't work
    echo test3(pointer)
    
    #works
    echo test3()
    echo test3(int)
    echo test3(float)
    echo test3(byte)
    
    
    Run

Reply via email to