It's not amazingly intelligent, but for scopes you can achieve this relatively 
easily with a template.
    
    
    template destroyEntity(n: untyped) =
      echo "destroyed: ", n
      template n =
        {.error: "Attempting to used destroyed '" & astToStr(n) & ".".}
    
    proc doThing(i: int) =
      if true:
        destroyEntity(i)
        echo i
      else:
        echo i
    
    doThing(100)
    
    
    Run

Reply via email to