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

add syntax for empty n-dimensional arrays #41618

Merged
merged 3 commits into from
Jan 11, 2022
Merged

Conversation

simeonschaub
Copy link
Member

Might be worth backporting to 1.7 for consistency? Otherwise, this should probably have a NEWS entry.

closes #41389
cc: @BioTurboNick

@simeonschaub simeonschaub added arrays [a, r, r, a, y, s] parser Language parsing and surface syntax labels Jul 16, 2021
@BioTurboNick
Copy link
Contributor

Nice, you didn't even have to touch julia-syntax.scm to make it work.

Currently the parser allows this:

[;;
;]
0×0×0 Array{Any, 3}

Line breaks between semicolons produce an error normally:

[1 ;;
;]
ERROR: syntax: semicolons may appear before or after a line break in an array expression, but not both
Stacktrace:
 [1] top-level scope
   @ none:1

@simeonschaub
Copy link
Member Author

Currently the parser allows this:

[;;
;]
0×0×0 Array{Any, 3}

Oh, weird, I thought the disallow-space would catch this.

test/syntax.jl Outdated
@test Int[;;] == Array{Int}(undef, 0, 0)
@test Int[;;;] == Array{Int}(undef, 0, 0, 0)

@test_throws ParseError Meta.parse("[ ;]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that leading/trailing spaces should be an error...

Copy link
Member Author

@simeonschaub simeonschaub Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think I agree. Will change it.

@vtjnash
Copy link
Member

vtjnash commented Aug 24, 2021

bump?

@simeonschaub
Copy link
Member Author

Probably better to not backport this PR at this point.

@simeonschaub simeonschaub added the needs news A NEWS entry is required for this change label Aug 25, 2021
@simeonschaub simeonschaub removed the needs news A NEWS entry is required for this change label Aug 26, 2021
@PallHaraldsson
Copy link
Contributor

Why probably not better to backport? If 1.7 ends up as LTS, then it's very useful to have all new syntax in. [I believe syntax can't be added with Compat.jl.]

@simeonschaub
Copy link
Member Author

1.7 won't become the LTS. The same argument could be made for any feature. 1.7 is already taking longer to finalize than usual, so I don't think we should stretch that out any further by backporting additional feature.

@simeonschaub
Copy link
Member Author

This should be ready, @JeffBezanson do you want to give this a review?

@simeonschaub simeonschaub added the merge me PR is reviewed. Merge when all tests are passing label Jan 11, 2022
@simeonschaub simeonschaub merged commit 18b825b into master Jan 11, 2022
@simeonschaub simeonschaub deleted the sds/empty_nd_arrays branch January 11, 2022 21:48
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Jan 12, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] parser Language parsing and surface syntax
Projects
None yet
Development

Successfully merging this pull request may close these issues.

syntax for creating empty n-dimensional arrays
6 participants