Hello, I have a question about destructors. I am not sure if I am 
misunderstanding something, or if this is a bug. When I declare a constructor 
for a type, it is not called if an instance of the object is created free in 
the main module (as opposed to within a proc).

For example, the destructor is not called here.
    
    
    {.experimental.}
    
    type
      MyObj = object
        a: int
    
    proc `=destroy`(m: MyObj) =
      echo "Destruct"
    
    let x = MyObj(a: 5)
    

Yet, if I place the declaration of x in a proc, it works fine: 
    
    
    proc works() =
      let x = MyObj(a: 5)
    
    works()
    

Do I misunderstand where values are deconstructed, or is this an issue for 
GitHub?

Reply via email to