Is Compat.jl worth it for the `public` keyword?

Why not just do

macro public(ex)
    if VERSION >= v"1.11.0-DEV.469"
        args = ex isa Symbol ? (ex,) : Base.isexpr(ex, :tuple) ? ex.args : error("something informative")
        esc(Expr(:public, args...))
    else
        nothing
    end
end

@public x, y

?

I strongly doubt this is worth bringing in Compat.jl for, that package is quite hefty with lots of piracy and invalidations.

7 Likes