Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immutable native structures #708

Closed
tomprimozic opened this issue Apr 12, 2012 · 2 comments
Closed

Immutable native structures #708

tomprimozic opened this issue Apr 12, 2012 · 2 comments

Comments

@tomprimozic
Copy link

Some fields of internal structures (such as types) should be immutable. Currently, one can do this:

julia> a = complex(1,2)
1 + 2im

julia> typeof(a).names = (:re, :im, :x)
(re,im,x)

Then, a.x returns a random value, and after a call to gc() it crashes the REPL.

The getfield function should prevent this, I think. On the other hand, the types field cannot be mutated.

@pao
Copy link
Member

pao commented Apr 12, 2012

#13

@JeffBezanson
Copy link
Member

Yes, this will be fixed when we address immutability. In the mean time, just don't do it :)

LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Ensure that all exported methods are included in the manual, so that
we can enable strict=true, which ensures that doctests pass.
Update doctests to latest Julia version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants