We can create template with like this: 
    
    
    template withFile(name: string, body: untyped) =
       let fh = open(name, ...)
       defer: close(fh)
       block:
          body
    

But when template contain await, the compiler will complain the 'await' is 
undeclared identifier. The code like this: 
    
    
    template withDb(body: untyped) =
       let db = await open(...)
       defer: close(db)
       block:
          body
    

Because the template is hygiene, and await is not removed by macro async, so 
the compiler will find undeclared 'await', but is there any way to make the 
code above works? Thanks. 

Reply via email to