> Specifically for structuring data, I have one advice: you use tuples instead
> of objects whenever you don't need the extra features that objects provide.
I'm against this advice. A `tuple` should be used when you need its feature
(ie. tuple unpacking, array-like accessing syntax, etc.). Otherwise, an
`object` should be used, and here's why:
* Easy to construct. The only way to construct a tuple is to remember exactly
the order of the fields.
* Objects are stronger-typed:
> > type
> ObjA = object
> a: string
> b: int
> ObjB = object
> a: string
> b: int
> A = tuple
> a: string
> b: int
> B = tuple
> a: string
> b: int
>
> proc foo(a: A) = echo "A"
> proc foo(b: B) = echo "B"
>
> # foo(A(("string", 10))) Error: ambiguous call; both in.foo(a: A)
> [declared in /usercode/in.nim(15, 6)] and in.foo(b: B) [declared in
> /usercode/in.nim(16, 6)] match for: (A)
>
> proc foo(a: ObjA) = echo "ObjA"
> proc foo(b: ObjB) = echo "ObjB"
>
> foo(ObjA(a: "string", b: 10))
>
>
> Run
Please also note that `object` does not have _any_ overhead over `tuple` if you
don't use it's more advanced features (ie. RTTI, but that's going away with
newruntime).