Semantically all objects are reference types in Julia. It just happens that if they're immutable the system is free to copy them or not since there's no way to tell the difference.
On Thu, Jan 21, 2016 at 9:21 AM, Erik Schnetter <[email protected]> wrote: > "Immutable" in this sense simply means that the objects are constant. > One could still meaningfully distinguish between equality (==) and > identity (===). My guess is that there's no urgent need for this in > Julia -- as a work-around, you can use a mutable type, and then not > modify objects once created. > > -erik > > On Thu, Jan 21, 2016 at 8:23 AM, Yichao Yu <[email protected]> wrote: > > On Wed, Jan 20, 2016 at 7:22 PM, <[email protected]> wrote: > >> Julia's immutable types are value types and mutable types are reference > >> types. In the Julia docs on types there is a paragraph that begins: > >> > >> "It is instructive, particularly for readers whose background is > C/C++, to > >> consider why these two properties go hand in hand. [...]" > >> > >> However this paragraph only explains why value types should be > immutable, it > >> doesn't describe why you can't define a reference type that is > immutable. > >> So, why not? > > > > Because there's no value type at all. A immutable reference type is > > effectively a value type. > > > > -- > Erik Schnetter <[email protected]> > http://www.perimeterinstitute.ca/personal/eschnetter/ >
