Created
September 22, 2011 17:38
-
-
Save Araq/1235428 to your computer and use it in GitHub Desktop.
Module injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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