Dosen't work as expected.
import tables
type
Dic = Table[string, int]
template `.`*(self: Dic, field: untyped): int = self[astToStr(field)]
template `.=`*(self: Dic, field: untyped, value: int) =
self[astToStr(field)] = value
proc `()`*(self: int, other: int): int = self * other
var
a: Dic
a.x = 3
a.y = 4
echo a.x # works. `.`(a, x)
echo a.y # works. `.`(a, y)
a.a = 3
echo a["a"] # works.
echo a.a # doesnt work.
# be recognized `()`(a, a)
# maybe it's because variable named "a" exists.
When there exists a variable having same name as right part of . , it is not recognized as . but as ()