Yes, something like that. I added --gc:arc support with finalizers some weeks 
ago, and destructor support yesterday. Note that we do not really need 
destructors for ARC, finalizers are ok also, I added them because of the 
subclassing problem, see Araqs reply to filcuc and my last edit in

[https://forum.nim-lang.org/t/5825#36241](https://forum.nim-lang.org/t/5825#36241)

You test with when defined(gcDestructors) while I do test with when 
compileOption("gc", "arc") -- I am not sure if both is the same. Note that you 
dont have to introduce the Value types explicitely just for ARC, we can write 
the destructors like this:
    
    
    $ grep -A7 "=destroy" ~/.nimble/pkgs/gintro-0.7.1/gintro/gtk.nim
      
      proc `=destroy`*(self: var typeof(SelectionData()[])) =
        if not self.ignoreFinalizer and self.impl != nil:
          boxedFree(gtk_selection_data_get_type(), cast[ptr 
SelectionData00](self.impl))
          self.impl = nil
    
    
    Run

So typeof(SelectionData()[]) is the trick to get the value object type from 
reference type.

Reply via email to