proc t(i: int): string =
if i != 0: return "OK"
echo t(1)
let x = t(0)
echo x
if x == nil: echo "is nil"
if x.isNil: echo "is nil"
if x == "": echo "is nil"
macro mconnect(arg: typed): untyped =
let sci = t(0)
if sci.isNil:
echo "nil1"
if sci == nil:
echo "nil2"
if sci == "":
echo "nil3"
mconnect(0)
Run
$ nim c t.nim
Hint: used config file '/home/stefan/Nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: t [Processing]
nil2
nil3
Hint: [Link]
Hint: operation successful (12093 lines compiled; 0.131 sec total;
16.324MiB peakmem; Debug Build) [SuccessX]
Run
So there is no "nil1" output, indicating sci.isNil is not true as expected (by
me).