lihaoyi / macropy

Macros in Python: quasiquotes, case classes, LINQ and more!
3.28k stars 178 forks source link

Pattern matching examples broken: global name '_matching' is not defined #67

Closed jrk closed 6 years ago

jrk commented 9 years ago

I ran into this as soon as I tried to use pattern matching in a module where I'm already using case classes. Even simply pasting the first pattern matching example from the README fails identically with:

Traceback (most recent call last):
  File "/Users/jrk/miniconda/lib/python2.7/site-packages/macropy/core/import_hooks.py", line 75, in find_module
    exec code in mod.__dict__
  File "path/to/schedule.py", line 38, in <module>
    print reduce(lambda a, b: a + b, Cons(1, Cons(2, Cons(4, Nil()))))
  File "path/to/schedule.py", line 32, in reduce
    with switch(my_list):
NameError: global name '_matching' is not defined

Mac OS 10.11b3 with Miniconda Python 2.7.10, MacroPy 1.0.3 installed from pip this afternoon.

azazel75 commented 6 years ago

This is fixed in current master branch using Python 3.4+