-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
TOML: Improve type-stability #55016
base: master
Are you sure you want to change the base?
TOML: Improve type-stability #55016
Conversation
This allows the `Dates` calls to be statically inferred
This changes the output of the TOML parser to provide specialize `Vector{T}` less aggressively, so that combinatorially expensive types like `Vector{Vector{Float64}}` or `Vector{Union{Float64,Int64}}` are instead returned as `Vector{Any}` Vectors of homogeneous leaf types, like `Vector{Float64}` are still supported as before. This change makes the TOML parser fully type-stable, except for its dynamic usage of Dates. Co-authored-by: Gabriel Baraldi <[email protected]>
5ac8234
to
9f91563
Compare
Probably good to parameterize here then: Lines 267 to 270 in ce4f090
However, Pkg.jl also uses this |
Is it coherent to have them share the cache, if one returns different objects than the other? That sounds problematic.. |
Yes, Pkg should probably have its own completely separate cache and if some project files are parsed twice (in Base and Pkg) then I guess that is whatever. |
This cache https://github.com/JuliaLang/Pkg.jl/blob/8c996799b0ae3d6cccf8a5f25744deb6640adb9e/src/Registry/registry_instance.jl#L18-L21 should probably thus be lifted up to the Pkg module and be used by all |
Actually it looks like that cache is already separate, along with the one in Types.jl |
9f91563
to
0a94145
Compare
OK, I've parameterized #55017 should be reviewed first, since this just adds one commit on top |
Dependent on #55017. This changes the output of the TOML parser to provide specialized
Vector{T}
less aggressively.Specifically, combinatorially expensive types like
Vector{Vector{Float64}}
orVector{Union{Float64,Int64}}
are instead returned asVector{Any}
, while vectors of homogeneous leaf types (e.g.Vector{Float64}
) are still supported as before.This change makes the TOML parser fully type-stable.