JuliaArrays / JuliaArrays/StaticArrays.jl

Should Scalar(1) .+ 1 return 2 or Scalar(2)?

Open
#775 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

broadcast design
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

If was brought up here: https://github.com/JuliaLang/julia/pull/35591 that one nice property of Ref is that

julia> Ref(1) .+ 1
2

whereas

julia> Scalar(1) .+ 1
Scalar{Int64}((2,))

I'm not sure how I feel about this difference yet, but I figured I should open an issue to discuss it.

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 reviewing the linked Julia PR #35591 and the current Scalar(1) .+ 1 behavior shown in the issue. Determine whether Scalar should match Ref by returning 2 or preserve Scalar wrapping; done requires a decided semantic direction and corresponding project changes.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.