Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Rust 2024 edition ## reservation #391

Open
traviscross opened this issue Dec 12, 2024 · 1 comment
Open

Compatibility with Rust 2024 edition ## reservation #391

traviscross opened this issue Dec 12, 2024 · 1 comment

Comments

@traviscross
Copy link

traviscross commented Dec 12, 2024

In Rust 2024, we'll be reserving -- at tokenization time -- the hash characters ## (and all longer joined sequences of hash characters). You can learn more about this change here:

In this commit 1f3418c of the peg crate, you added "##method() syntax to call a method on the input object".

Users who migrate to Rust 2024 will not be able to use this syntax.

Generally, our recommendation to callers of macros that expect ## would be to add a space. However, that doesn't work in the case of the peg crate, as the implementation checks specifically for jointness.

We notice that though this feature was added many years ago and that it doesn't seem to be documented or, as best as we can tell, widely used.

We're curious what the story is on this feature. In particular we want to check that there's not some critical use case for this that we've missed. And we're curious about how or whether you'll migrate this feature. Given that it was seemingly never documented, we wonder whether you even meant for this to be part of the surface area of your crate.

Thanks.

See:

cc @kevinmehall

@kevinmehall
Copy link
Owner

The ##method() syntax is an escape hatch for calling into a method on the parser input as if it were a parse rule. When I added it, it was intended to be temporary, because I needed it for rust-peg's own parser for the PEG grammar DSL. I actually used the ## with the intention of reserving the single # for a more flexible version of the feature that takes a block of Rust code rather than specifically a method on the input type.

6 years later, I guess it's not so temporary, and I still need to decide on the exact syntax for that replacement, but I'm fine with deprecating the ## syntax. Since it was never documented, I expect few people to be using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants