[EDIT] Well, does not even work correctly, expected result would be
"times.DateTime". "When compiles()" give the same.
import times, macros
macro m(o: typed): untyped =
#let ot = getType(o)
let oti = getTypeInst(o)
#let s1 = $ot.toStrLit
let s2 = $oti.toStrLit
#echo s1
echo s2
if compiles("var h:" & "tables." & s2):
echo "tables." & s2
elif compiles("var h:" & "times." & s2):
echo "times." & s2
var x: times.DateTime
m(x)
DateTime
tables.DateTime
Why I may need the module? Well, some months ago someone asked if we can use
GtkBuilder with gintro. Answer is yes of course, but to make it typesafe we
would have to create a macro which tests type of result from
Builder.getObject(). In most cases module will be gtk, but not always. For
example, if we pass a var of type Button, we would have to check if result
returned by Builder.getObject() is GtkButton.
([https://developer.gnome.org/gtk3/stable/ch01s03.html](https://developer.gnome.org/gtk3/stable/ch01s03.html))