JuliaArrays / JuliaArrays/ArrayInterface.jl
Should we have `freeze` and `thaw`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 140
- Forks
- 44
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 5
Description
I've seen freeze(x) and thaw(x) thrown around for making x immutable and mutable, respectively. I'm not sure if we should wait for base to formalize the ImmutableArray approach, or if it's worth have some common syntax for that right now. I'm not sure if we're ever going to get much petter than this pattern:
function foo(x)
y = similar(x)
foo!(y, x)
if ismutable(x)
return y
else
return freeze(y)
end
end
# change values of `y`
foo!(y, x) = ...
Which might be fine if we can ensure that freeze(y) and similar(x) are close so that the compiler can easily figure out what to allocate to the stack and elide unnecessary allocations.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This is a design discussion about freeze/thaw, ImmutableArray, similar, and ismutable rather than a scoped file change. Start by reviewing Julia/Base's ImmutableArray approach and the existing array-interface conventions. Done would require agreement on whether to add common freeze/thaw syntax and a defined implementation scope, which the issue does not provide.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100