Difference between type and struct
This is quite a mess in your sources, since it mixes different meanings from non-compatible epochs in the history of the language.
- Originally (pre 0.7, I think?), composite types were declared with either
type
orimmutable
, wheretype
was used for mutable types (there also wasbitstype
for what is now called "primitive types"). - Now, we have
mutable struct
andstruct
for the sampe purposes (and, consistently with it,primitive type
andabstract type
).
So, basically the names have changed so that all ways to define types becomes a bit more consistent, and immutable structs have become the "unmarked" case.
"Mutable" in this context means that you can't reassign a field (p.x = 3
). It does not imply that the contents of a field cannot be changed, it they happen to be mutable (something.v[1] = 2
will also work if something
is an immutable type!).