JuliaLang / Compat.jl

Compatibility across Julia versions
Other
142 stars 117 forks source link

Add `public` to the `@compat` macro #805

Closed LilithHafner closed 10 months ago

LilithHafner commented 10 months ago

The documentation included in this PR should make the PR itself self-explanatory. If it's not self-explanatory, then it's not acceptably documented.

codecov[bot] commented 10 months ago

Codecov Report

Merging #805 (d74c2f3) into master (c59d116) will increase coverage by 0.41%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #805      +/-   ##
==========================================
+ Coverage   92.72%   93.13%   +0.41%     
==========================================
  Files           2        2              
  Lines         316      335      +19     
==========================================
+ Hits          293      312      +19     
  Misses         23       23              
Files Changed Coverage Δ
src/Compat.jl 93.22% <ø> (ø)
src/compatmacro.jl 92.50% <100.00%> (+6.78%) :arrow_up:
fredrikekre commented 10 months ago

Can I propose @compat public foo, bar?

LilithHafner commented 10 months ago

Is @compat already used or would this be the only non-deprecated use of the @compat macro?

fredrikekre commented 10 months ago

It used to be used for all these kind of things in the past, and it is still there: https://github.com/JuliaLang/Compat.jl/blob/c59d116e7039db494ac61548a52651f3d8ba7b30/src/compatmacro.jl#L26

LilithHafner commented 10 months ago

IIUC @compat was used for syntax changes in the pre-1.0 erra, and was rendered a no-op when Compat.jl dropped support for pre-1.0 code? If that history is correct, then @compat public foo, bar seems appropriate.

fredrikekre commented 10 months ago

But that was because Compat.jl dropped support for pre Julia 1.0, no? Then there was no point in having all the old syntax transformations.

LilithHafner commented 10 months ago

@fredrikekre, I think we are in agreement. I also prefer your proposed syntax. We should probably wait at least a day or so to let other folks chime in, though.

mcabbott commented 10 months ago

This does not seem to allow macros:

julia> @compat public fun, @mac
ERROR: LoadError: ArgumentError: cannot mark `(fun, #= REPL[15]:1 =# @mac())` as public. Try `@compat public foo, bar`.
LilithHafner commented 8 months ago

Should this be backported to 3.x?

lgoettgens commented 8 months ago

Should this be backported to 3.x?

I would be in favor of this. There are many packages out there that support julia versions older than 1.6 and are thus unable to depend on Compat 4. Personally, I would really like to use @public via a Compat-compatible way in Aqua.