There are always workarounds since CPUs are little state machines. That should 
be news to no one. Recursion working makes code look much nicer, IMO. For what 
it's worth, the example considered among the more compelling by the Python guys 
back in the Python 2.3 days when they added generators was in-order binary 
search tree traversal: 
    
    
    iterator inorder[T](t: Tree[T]): T =
      if t:
        for x in inorder(t.left): yield x
        yield t.label
        for x in inorder(t.right): yield x
    
    
    Run

which parallels the usual recursive call structure quite well. I think it would 
be great if the above Nim actually worked. Equivalent state machines are often 
ugly, trickier to get right, and a pain point (and yeah, usually faster). But 
"expressive" has always been a main goal of Nim. :-)

Reply via email to