-
-
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
Expr consistency and stability #53531
Comments
To be more concrete, this is an example of an inconsistency I noticed recently. julia> :(f(x, y)) |> dump
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol f
2: Symbol x
3: Symbol y
julia> :(+(x, y)) |> dump
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol +
2: Symbol x
3: Symbol y But very different with broadcasting: julia> :(f.(x, y)) |> dump
Expr
head: Symbol .
args: Array{Any}((2,))
1: Symbol f
2: Expr
head: Symbol tuple
args: Array{Any}((2,))
1: Symbol x
2: Symbol y
julia> :(.+(x, y)) |> dump
Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol .+
2: Symbol x
3: Symbol y The last one isn't just inconsistent, but also generally weird: it claims to be a call to a function named julia> Main.:.+
ERROR: UndefVarError: `.+` not defined in `Main` Can this or other example parse in a different way in a new Julia version? |
So, can we rely on existing parsing rules, are they considered stable? |
To Jameson's point, significant effort has been put into ensuring and maintaining stability. The last breaking change I can recall to expression parsing was when we started preserving |
Many packages rely on the structure of parsed
Expr
s, mostly to implement transformations in macros.Sometimes, Expr parsing results aren't too consistent. And I wonder if they are considered stable/public in Julia 1.x or not. Can parsing results of expressions change? Would be nice to clarify that, especially given the recent history of backwards incompatible changes in Julia, some of which aren't acknowledged as breaking even when they lead to failures in popular packages.
The text was updated successfully, but these errors were encountered: