What's Julia's memory model like; e.g. regarding aliasing?


For the longest time, C++ didn’t have a memory model (now it does, and e.g. CPUs x86 and ARM implement it).

I know also that Java has a memory model, but never heard of other languages having defined.

Can you assume Julia’s is same as C++'s?

Or with the possible change of having Fortran’s aliasing rules (not sure if that’s part of what you would include in a “memory model”, as opposed to a “programmer model”?).

Looking up “aliasing” in the manual I get 103 “matches”, but it’s e.g. not in one (none?) of them:



In C/C++ “no aliasing” can’t be assumed, why C (not C++ portably) has restrict keyword. In Fortran, no aliasing is assumed (i.e. as you would use restrict always, is my understanding).

This make Fortran faster by default, generated code of, as the compiler has to do less work. An opposing view is that it means the programmer has to do more work, make sure there actually is no aliasing (overlapping memory regions). It’s not clear to me that it’s hard there or in Julia (or MATLAB).

Can I assume Julia is more, or exactly, like Fortran as in other respects (e.g. row vs. column major).

I see this long/old thread with (starting with):

“Currently, the Julia manual says nothing at all about aliasing among function arguments.”