andyferris / Freeze.jl

Experimental API for mutable/immutable collections
Other
3 stars 0 forks source link

Freeze.jl

A minimal package to expose an interface for reasoning about and controlling the mutability of indexable containers, via:

In the general case, the above might require copying the contents of x, but in practice we expect the Julia compiler to become good at reasoning about the lifetime of objects via escape analysis (as it can already do for structs).

NOTE: The current implementation here for AbstractArray might be unsound because it does not perform defensive copying! This package provides interface guarantees around setindex! only - actual values may mutate if the underlying data structures are accessed directly. It may be useful for experimentation or preventing some varieties of bugs.

See also Base.Experimental.Const in Julia 1.3 onwards, and the ArrayInterface.jl package.