Skip to content

Instantly share code, notes, and snippets.

@Araq
Created September 22, 2011 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Araq/1235428 to your computer and use it in GitHub Desktop.
Save Araq/1235428 to your computer and use it in GitHub Desktop.
Module injection
# module A
when not defined(dolog):
template dolog(msg: string) = nil
proc whatever() =
dolog "start of whatever"
doSomeWork
dolog "end of whatever"
# module B
template dolog(msg: string) =
echo msg
# module injection via 'include' :-)
include moduleA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment