Yes you are right. I was thinking about type definiton while the question was
about variable definition. Thanks.
@aguspiza, I think you are confused about mutability/immutability, var and ref.
var means mutable. ref means object on the heap with reference semantics. They
are somewhat orthogonal concepts.
Use var sdl_rect : Rect If you ate going to process a lot of them sequentially.
Use var sdl_rect : ref Rect If you only handle those instances individually or
if you use OOP or if there is a lot of fields (data) in the object
In the example it's not a pointer though, it's a stack object (assuming Rect is
a simple object).
I disagree, at least regarding the question in the title.
A ref is always preferable unless one _needs_ a pointer. And the heap vs. stack
is not Nim specific.
`var sdl_rect : Rect` is better.
That is not an easy topic for a beginner, you may start with
[https://peterme.net/nim-types-originally-a-reddit-reply.html](https://peterme.net/nim-types-originally-a-reddit-reply.html)
I'm still new to Nim (got it a couple of days ago).
Both versions work. Which one is better? (It is not clear, or I have missed
something in docs.)
The first:
var sdl_rect : Rect
sdl_rect = ( (cint)0, (cint)0, (cint)10, (cint)10 )
# usage: (addr sdl_rect), when ptr Rect is