genSym support for hygienic macros and templates.

example:
template hygienic(val: expr) =
  var `*x` = val
  echo `*x`

*x was chosen as mnemonic for "opposite of public" and thus private
This commit is contained in:
Zahary Karadjov 2012-03-26 04:36:26 +03:00
commit 6216046bc6
6 changed files with 34 additions and 70 deletions

12
tests/compile/tgensym.nim Normal file
View file

@ -0,0 +1,12 @@
template hygienic(val: expr) =
var `*x` = val
stdout.write `*x`
var x = 100
hygienic 1
hygienic 2
hygienic 3
echo x