You can also use AST based overloading
[https://nim-lang.org/docs/manual_experimental.html#ast-based-overloading](https://nim-lang.org/docs/manual_experimental.html#ast-based-overloading)
(which isn't actually experimental even though it appears there). In this case
all the overloads will need to be untyped to avoid typechecking invalid AST.
import macros
macro `@@@`(x: untyped{nkTableConstr}): untyped =
echo x.treerepr
result = newNimNode(nnkTableConstr).add(x[0])
macro `@@@`(x: untyped{nkBracket}): untyped =
echo x.treerepr
result = x
macro `@@@`(x: untyped{nkStrLit}): untyped =
echo x.treerepr
result = x
var a = @@@{"fromStruct": "blah", "sub": {"joe": 10}}
var b = @@@[1,2,3]
var c = @@@"test"
Run