Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add deprecations for some removed
copy
methods
ref #15675
- Loading branch information
063ef32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DWARF.jl has a variable which is either a Tuple (register, offset pair) or an array (DWARF expression). It is somewhat annoying that I can't just copy that variable.
063ef32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really get this --- if you're copying it, presumably you're mutating it at some point. But tuples can't be mutated, so those cases are already split somehow. What am I missing?
063ef32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's something like
where evaluate_expression! could potentially mutate. It doesn't at the moment (so I removed the copy), but it quite reasonably could.
063ef32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is that most of the time it doesn't matter whether it's a register/offset pair (you still move them around just the same). Only when you evaluate it do you care.
063ef32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems quite possible to structure that so that calling
copy
on a tuple isn't actually needed, especially since there is already anisa
check somewhere in the code. I find it kind of obfuscated to callcopy
on something and have it be a no-op.In my view
copy
is part of a mutable collections API. If not, then what is it? Should we havecopy(x) = x
? In languages with both mutable and immutable collections, I believe it's most common not to providecopy
for immutable collections.