brunal commented on PR #9454:
URL: https://github.com/apache/arrow-rs/pull/9454#issuecomment-3977496362
About each arm:
| Arm # | Accepts | Turns into | Comment |
| - | - | - | - |
| 1 | `foo => thing(),` | `foo => { thing() }` | |
| 2 | `(foo, bar) => thing(),` | `foo, bar => { thing() }` | Not sure why
the parentheses around args get removed |
| 3 | `foo, bar => { thing() }` | `(foo, bar) => { thing() }` | |
| 4 | `(foo, bar) => { thing() }` | another macro | |
I think we can update (2) to avoid the trip through (3).
I don't really understand the point of the pattern (3) apart from catching
what's emitted by (2).
> I'm pretty sure we can simplify the macro to just two arms, because
$e:expr actually matches {...} just fine, and macro expansion handles the comma
vs {} thing automagically:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=cddb9bf00fca4bb2f3a77df3c84def8d
I'm not sure what you mean here. In your example you cannot skip the comma
after `{ 20 }`. I don't think we can have a single arm for `thing(),` and `{
thing() }`.
OK for restoring the explicit syntax in the 4th arm.
OK for turning `$(if $pred:expr)*` into `$(if $pred:expr)?`.
I've now updated the changes. Recap:
1. Use a muncher in recursive macro calls. That's much lighter on
compilation/rust-analyzer.
2. Accept a single `if pred` (multiple lead to invalid generated code anyway)
3. Don't unwrap `(foo, bar)` into `foo, bar` that gets wrapper back later on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]