History Lesson Required About Type,Immutable,Struct, Mutable Struct


I want to have a history lesson from a julia historian.

type X

struct X

mutable X

immutable X

what are the differences?
and how it appeared through the history.

The history can be digged up through github issues/prs?

You may find the v0.6.0 release notes useful, particularly the Language changes section.

In general, release notes are a good place to start for history, since they link the PRs and issues, which have the discussion (or links to more discussion :wink:). You can view them easily using the “switch branches/tags” button on Github.


In the beginning there was only one composite type and it has been named: type. In Julia version 0.2 immutable (immutable type) has been added.

I imagine, naming is difficult: you have a mutable struct type and an immutable struct type. But you cannot force people to spell it out in full and the question is, how to shorten it?

The original choice, type, has been found to be too generic. In a long winded but interesting issue the current names have been choosen:

type X .. end       --> mutable struct X .. end
immutable X .. end  --> struct X .. end

As mentioned, the v0.6 NEWS is interesting. For (mutable) struct differences check out the manual. As your question is about types you might be interested in the ‘The state of the Type System’ talk by Jeff Bezanson (youtube, see e.g. at around 02:45).