JuliaSyntax.jl icon indicating copy to clipboard operation
JuliaSyntax.jl copied to clipboard

Experiment: Make macros bind stronger than commas within parentheses

Open c42f opened this issue 2 years ago • 3 comments

As discussed in https://github.com/JuliaLang/julia/issues/36547

That is, f(@x a, b) parses as

(call f (macrocall a) b)

rather than

(call f (macrocall (tupel a b)))

Unfortunately, this is mildly breaking, due to such strange syntax as (@unpack a,b = c)

c42f avatar Mar 03 '23 22:03 c42f

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.68%. Comparing base (2a0efad) to head (0a0ffa3). Report is 85 commits behind head on main.

Files Patch % Lines
src/parse_stream.jl 86.66% 2 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #212   +/-   ##
=======================================
  Coverage   96.68%   96.68%           
=======================================
  Files          14       14           
  Lines        4007     4008    +1     
=======================================
+ Hits         3874     3875    +1     
  Misses        133      133           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 03 '23 22:03 codecov[bot]

Perhaps it'd make sense to deprecate f(@x a, b) and/or introduce warnings, but changing the semantics from one valid interpretation to another would be horrible. Please don't do it before Julia v2.

nsajko avatar Jun 25 '24 14:06 nsajko

changing the semantics from one valid interpretation to another would be horrible

It's "horrible", but evidence suggests that users don't understand the existing precedence and actively write bugs with the existing semantics. Look at the analysis here

If we fix more cases in the ecosystem than we break by making this change, is that actually "horrible"? There's no right answer, only tradeoffs.

c42f avatar Jul 18 '24 02:07 c42f