1discard """ 2 nimout: "static 10\ndynamic\nstatic 20\n" 3 output: "s\nd\nd\ns" 4""" 5 6type 7 semistatic[T] = 8 static[T] or T 9 10template isStatic*(x): bool = 11 compiles(static(x)) 12 13proc foo(x: semistatic[int]) = 14 when isStatic(x): 15 static: echo "static ", x 16 echo "s" 17 else: 18 static: echo "dynamic" 19 echo "d" 20 21foo 10 22 23var 24 x = 10 25 y: int 26 27foo x 28foo y 29 30foo 20 31 32