I'm still getting confused about the do notation. In particular I'm surprised 
that the following gives an error "redefinition of x":
    
    
    import future
    
    proc takesFunc(f: () -> void) =
      f()
    
    takesFunc do:
      var x = 1
    
    takesFunc do:
      var x = 1
    

The manual mentions something that `do` without parenthesis is just a block. I 
don't understand that, what is the compiler passing to the function in this 
case?

Adding some empty parentheses after the `do` solves the problem, but if the 
version without the parentheses is not creating an anonymous proc, shouldn't 
this lead to a more meaningful error? Otherwise finding such a bug is a bit by 
chance like in my case with the redefinition.

Reply via email to