Skip to content

Make the parse module public #23

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

Closed
wants to merge 2 commits into from
Closed

Make the parse module public #23

wants to merge 2 commits into from

Conversation

andrew-d
Copy link

Ref: #22

EDIT: Apparently my second commit has a wonky commit message - it's supposed to read: "Implement Copy for Repeater"

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@BurntSushi
Copy link
Member

So I guess the primary concern I have with this is that the AST is really an implementation detail of regular expressions, and as such, it could change in the future.

I am personally satisfied if the module documentation contains a clear warning that clients cannot rely on the interface to be stable, but that seems kind of wonky given 1) semantic versioning and 2) Rust's current approach to stability, which is, "if it isn't stable, don't let people use it."

On the other hand, having a regex parser can be immensely useful. The parser itself is at least as complicated as the VM, so it's a good piece of code to have available for general use.

@andrew-d
Copy link
Author

Yeah, I agree that this is not something we want to commit to stability - but, like you said, the parser is super-useful to have available for common use. I considered also marking it as #[doc(hidden)], but all that really does is make it a bit more irritating to read about.

I'm happy to either put a big warning in the module-level documentation, or just outright hide it. I'd be interested in the input of @alexcrichton or any other core-team members here.

@BurntSushi
Copy link
Member

I'm not a fan of hiding it. I see #[doc(hidden)] as a tool to expose something that shouldn't be exposed but must be exposed. For example, a whole bunch of internals are actually public so that regex_macros can use it: https://github.com/rust-lang/regex/blob/master/src/lib.rs#L391-L421

But yes, more input is welcome!

@alexcrichton
Copy link
Member

In terms of long-term stability I believe I'd expect an implementation detail such as this to remain private, but we're not currently providing a whole bunch of guarantees about the stability of external crates beyond "we'll follow semver". I would personally err on the side of being conservative and leaving it private for now, although I don't have a great grasp on how it might change in the future.

Basically my consideration would be that any modification to the parser which broke an API would require a new major version for the crate, which is just something to balance :)

@andrew-d
Copy link
Author

Basically my consideration would be that any modification to the parser which broke an API would require a new major version for the crate, which is just something to balance :)

That's a fair point, yeah. I wonder if there's a sensible way to say "this module is completely free from any stability guarantees" - essentially, omit it entirely from semver. I think that for internals like the parser, that's an entirely reasonable stance to take.

@alexcrichton
Copy link
Member

Unfortunately we don't currently have a method of enforcing that sort of guarantee, so this may end up being too much of an overcommitment for now.

@BurntSushi
Copy link
Member

That's fair.

@andrew-d For now, I'd recommend doing a copy & paste of the parser. We can re-examine opening it up later when we're more confident that it's actually stable.

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

Successfully merging this pull request may close these issues.

4 participants