I think I heard about that in nim forum long time ago, but tested only with 
default gc, where destroy is not called. But with ARC it is called indeed 
currently, and gc_ref/unref seems to work also, so gintro and other packages 
using finalizers may survive.
    
    
    type
      O = object
        i: int
      
      R = ref O
    
    proc `=destroy`(x: var O) =
      echo "destroy"
    
    proc main =
      var r = R(i: 7)
      echo r.i
      GC_ref(r)
      GC_unref(r)
    main()
    
    
    Run
    
    
    $ nim c --gc:arc t.nim
    $ ./t
    7
    destroy
    
    
    Run

Reply via email to