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 or immutable, where type was used for mutable types (there also was bitstype for what is now called "primitive types").
  • Now, we have mutable struct and struct for the sampe purposes (and, consistently with it, primitive type and abstract 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!).

Tags:

Julia