-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
x[i,j] and x[i;j] are parsed the same #8541
Comments
cc @mlubin |
#8250 didn't change this behavior. In 0.3 The 2D case works as you would expect: julia> [1 1; 2 2]
2x2 Array{Int64,2}:
1 1
2 2
julia> [[1 1]; [2 2]]
2x2 Array{Int64,2}:
1 1
2 2
julia> [[1 1], [2 2]]
2x2 Array{Int64,2}:
1 1
2 2 |
The problem seems to be that parsing |
Which is necessary to support array syntax for typed arrays |
That makes sense. If we change |
Right, it seems like they should be parsed differently regardless of the current behavior of |
+1 to parsing them differently (and for dropping automatic concatenation...) |
Any way we could resolve this before a decision is made on #8599? |
I've marked this as "up for grabs". It's a slightly tedious though relatively straightforward parser change. I think that if you want to change the way this parses, as long as it doesn't break stuff, it's fine. |
Is this fixed now?
|
Yup. julia> Meta.show_sexpr(:(x[i,j]))
(:ref, :x, :i, :j)
julia> Meta.show_sexpr(:(x[i;j]))
(:typed_vcat, :x, :i, :j)
julia> Meta.show_sexpr(:(x[i,j;k]))
(:typed_vcat, :x, (:parameters, :k), :i, :j) |
Shouldn't |
Yes, but I feel that is a separate issue. We currently give a really bad error message as well: julia> Int[1,2;3,4]
ERROR: unsupported or misplaced expression parameters whereas in v0.3 we gave something more helpful julia> Int[1,2;3,4]
ERROR: syntax: unexpected semicolon in array expression related to #9601 |
Consider
What's the rationale for this behavior? This is now seems ambiguous, since #8250 gives
The text was updated successfully, but these errors were encountered: