Hacker News new | ask | show | jobs
by def- 4194 days ago
I think that should be

    type refCounted[T] = object
      val: T
      refs: int
You could try a destructor for the object: http://nim-lang.org/manual.html#destructors