With the introduction of public by @Lilith, many packages will want to mark their unexported public symbols that way. Since public is only available in Julia 1.11, the current recommended way to do this in 1.10 is with the Compat.jl package. Before we add it everywhere, I’m wondering if there are any negative side effects to it? @stevengj seems to think it’s fine but I’d love to get other opinions.
In particular, it depends on 4 stdlibs: Dates, LinearAlgebra, TOML and UUIDs.
@static VERSION >= v"1.11" && eval(Meta.parse("""include("public.jl")"""))
I’ve tried this a while ago without eval, generally it worked but had some side effects (not in the code execution, I can’t remember exactly what), and I switched to Compat.jl after the opinion by stevengj.
P.S. Discourse makes 2 lines of code out of 1 source line because of &&
@static partially evaluates expressions at macro-expansion time which is only useful if macro expansion is invalid on a previous version. include macro expands just fine on all versions so there’s no need for @static.
To ask if something is “worth it” you need to ask about weight on the other side of the scale. What are we talking about here? Maybe a second worth of precompile time, once? Even less? Its four dependences are all (still) old-style stdlibs baked into Julia’s default sysimage, no?
JuliaSyntax.jl is a new stdlib in 1.10. It defines the new keyword public and people want workarounds to work with 1.10 LTS, for package code, though most likely some packages will get left out.
It already has an option JULIA_USE_FLISP_PARSER to 1
It could add JULIA_ADD_PUBLIC_KEYWORD env var, off by default, for “compatibilty”/semver reasons. I would rather want it the other way though.
Some stdlibs are upgradable, not sure about that one…
When 1.11 comes out, why should packages try and support 1.10? If they want to use a feature in 1.11 why not just keep things simple and set julia compat to 1.11. In my experience adding any nonessential dependencies or weak dependencies quickly leads to dependency hell when working on a complex Julia code base.