-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add copy #54
base: master
Are you sure you want to change the base?
Add copy #54
Conversation
FWIW, I remember Jeff being opposed to having a julia> copy((1,2))
ERROR: MethodError: no method matching copy(::Tuple{Int64,Int64}) |
I think this is a better example: julia> copy(1:2)
1:2 |
With using |
Ah I didn't realise julia> copy(x) === x
true
julia> BigFloat(1) === BigFloat(1)
false Perhaps I should just do a standard |
If you want to make sure that mutating a |
|
¯\_(ツ)_/¯ |
BigFloat is supposed to be semantically immutable but their implementation doesn't let us do that now.
|
I don’t think it actually solves a problem. I’m inclined to change it to copy(d::Domain) = d |
Isn't defining copy(d::Domain) = isbits(d) ? d : deepcopy(d) |
You are certainly right, at least in theory. In practice, I can’t think of a case where it matters. But for the sake of not intentionally writing “bad“ code I’ll make that change and only override for |
This PR adds a copy method. The easiest way to do this was to call
deepcopy
, @ararslan @timholy is there any hidden issue in doing this?