Skip to content
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

streamline a[begin] lowering via firstindex(a, n) #35779

Merged
merged 7 commits into from
Dec 1, 2020

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented May 6, 2020

Suggested by @mbauman in #33946 (comment)

@stevengj stevengj added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label May 6, 2020
@mbauman
Copy link
Sponsor Member

mbauman commented May 6, 2020

Thanks! I do fear this is a "minor change" as it requires non-AbstractArrays that define axes to now also implement firstindex... but they also need to implement lastindex so I don't think it's that big a deal.

@StefanKarpinski
Copy link
Sponsor Member

Would it make sense to include in 1.5 since we haven't branched yet?

@mbauman
Copy link
Sponsor Member

mbauman commented May 6, 2020

The A[begin] lowering was added in 1.4 so it's a change either way. (edit: whoops, wrong button)

@mbauman mbauman closed this May 6, 2020
@mbauman mbauman reopened this May 6, 2020
@stevengj stevengj added the triage This should be discussed on a triage call label Aug 25, 2020
@mbauman
Copy link
Sponsor Member

mbauman commented Aug 25, 2020

I think this is a worthwhile change (and I'd bet will be unobjectionable to triage), just could use NEWS.md.

@stevengj stevengj added this to the 1.6 features milestone Nov 2, 2020
@stevengj
Copy link
Member Author

stevengj commented Nov 2, 2020

Should be good to merge?

NEWS.md Outdated Show resolved Hide resolved
@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Nov 30, 2020
NEWS.md Outdated Show resolved Hide resolved
@stevengj
Copy link
Member Author

linuxaarch64 is the usual unrelated NaN == Inf error that we've been seeing recently on CI, so this should be good to merge once the other tests are green.

@JeffBezanson JeffBezanson merged commit 59d676c into master Dec 1, 2020
@JeffBezanson JeffBezanson deleted the stevengj-patch-6 branch December 1, 2020 06:00
@nalimilan
Copy link
Member

FWIW this technically breaks some packages like DataFrames which implemented axes but not firstindex. That's probably OK for since we can fix it soon, but it might be worth adding a fallback firstindex definition that calls axes to minimize breakage.

Cc: @bkamins

@stevengj
Copy link
Member Author

stevengj commented Dec 5, 2020

For that matter, a fallback lastindex seems worthwhile too.

@StefanKarpinski
Copy link
Sponsor Member

Better to be consistent here and there's no harm since it's a fallback anyway.

@bkamins
Copy link
Member

bkamins commented Dec 6, 2020

I think it would be best to provide a fallback in Julia Base.

The problem is that the firstindex and lastindex interface https://docs.julialang.org/en/v1/manual/interfaces/ is now specified only for firstindex(collection) and lastindex(collection) (without the dimension).

If you agree I would recommend that the interface specification should be updated in the manual in a PR that implements the fallback.

@stevengj
Copy link
Member Author

stevengj commented Dec 7, 2020

Should be fixed by #38742.

giordano pushed a commit that referenced this pull request Jul 21, 2024
`a[begin]` indexing was added by #35779 in Julia 1.6, so this feature
needs a compat notice in the docstring.
mbauman pushed a commit that referenced this pull request Jul 22, 2024
Correction to #55197: `a[begin]` indexing was added in Julia 1.4
(#33946), not in Julia 1.6 (which just changed the implementation in
#35779). My bad.
KristofferC pushed a commit that referenced this pull request Jul 23, 2024
`a[begin]` indexing was added by #35779 in Julia 1.6, so this feature
needs a compat notice in the docstring.

(cherry picked from commit 43df7fb)
KristofferC pushed a commit that referenced this pull request Jul 23, 2024
Correction to #55197: `a[begin]` indexing was added in Julia 1.4
(#33946), not in Julia 1.6 (which just changed the implementation in
#35779). My bad.

(cherry picked from commit 06467eb)
KristofferC pushed a commit that referenced this pull request Jul 24, 2024
`a[begin]` indexing was added by #35779 in Julia 1.6, so this feature
needs a compat notice in the docstring.

(cherry picked from commit 43df7fb)
KristofferC pushed a commit that referenced this pull request Jul 24, 2024
Correction to #55197: `a[begin]` indexing was added in Julia 1.4
(#33946), not in Julia 1.6 (which just changed the implementation in
#35779). My bad.

(cherry picked from commit 06467eb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants