I am trying to make a macro which takes an untyped block but can be still
overloaded by any other routine with the same name (mainly to avoid name
conflicts). In the other words: I'm looking for something which means "bind
symbol in calling scope" (NOT in the macro's scope, which is the default). Does
anyone know a way to do it?
Example:
foreach i in 1 .. 10: # calling `macro foreach(head, body: untyped):
untyped`
...
var seq = @[1, 2, 3, 4, 5]
s.foreach(echo) # calling `proc foreach[T](arr: openArray[T], fun: proc
(x: T) {..})`
Of course I wouldn't like the macro to have to know about every possible
overloader and try as it would be pretty much pointless.
I'm not sure whether it actually is possible, but hope it is.