upvote
Nim's better than dlang in this respect. Default memory management is similar to C++ and Rust. See https://nim-lang.org/docs/destructors.html
reply
Optionally but not by default ... things have changed a lot:

https://nim-lang.org/docs/mm.html

reply
Reference counting by default is GC.
reply
ref counting is only performed if you use `ref` types, e.g.

  type 
    RefObj = ref object
      foo: string
      bar: int

    ValueObj = object
      foo: string
      bar: int

`RefObj` is ref counted equivalent to a shared_ptr in C++ land (non-atomic counter unless using --mm:atomicArc or Nim3/Nimony has this as a default I believe). `ValueObj` is equivalent to struct in C, C++, etc.
reply