type
# An object which will be allocated on stack
Animal = object
name: string
legs: int
# Non ref objects (stack objects) cannot be mutated
# inside methods
proc setName(a: var Animal, name: string) =
a.name = name
var dog = Animal(name: "shadow", legs: 4)
dog.name = "lucy"
dog.setName("jimmy")
# Object types can be converted to string with $
echo $dog