if you want to roll your own,
    
    
    import macros
    type MaybeStatic[T] = static[T] | T
    template constLet[T](id:untyped, v:MaybeStatic[T]) =
      when v is static:
        const id = v
      else:
        let id = v
    proc f(x:MaybeStatic[int]) =
      constLet(y,x)
      expandMacros:
        echo y
    
    f(3)
    var x = 2
    f(x)
    
    
    Run

Reply via email to