proc `=destroy`(self: var SomeClass) = echo "destroying " & $self Run
Destructors work not very smoothly. At least with global variables. Types (including object types) are infered in Nim. As `newSomeClass` is declared above as returning `SomeClass`, you don't need to declare the variable's type - compiler can determine it unambiguously. But you still can to state it explicitly, `var Aclass: SomeClass = ...`, compiler will check it. You can assign variable later, then its type is required at definition. I.e., this all is not related to OOP, just to variables. Very concise still exhaustive Nim's [manual](https://nim-lang.org/docs/manual.html) explains well both topics.