JuliaArrays / JuliaArrays/OffsetArrays.jl

Completely stop pirating Base methods

Open
#306 22 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
212
Forks
45
PR merge metrics
No merged PRs in 30d

Description

In a session where OffsetArrays is a dependency of some package that I'm using, this is very strange to see:

julia> zeros(10:20)
11-element OffsetArray(::Vector{Float64}, 10:20) with eltype Float64 with indices 10:20:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

This really should be an error. An OffsetArray is not at all what I wanted. I simply made a typo.

The main problem with this is it breaks simple mental models for understanding what has gone wrong in arbitrary julia code. Base type + Base method returning a package type should be completely outside of what we expect as a possible behavior.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with zeros(10:20) and tracing which OffsetArrays methods cause the Base call to return an OffsetArray. Determine the intended behavior for these Base methods, then update the relevant package behavior and tests so the accidental call no longer produces an OffsetArray.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.