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

impl Trait and making Chomp require nightly #50

Closed
m4rw3r opened this issue Aug 28, 2016 · 3 comments
Closed

impl Trait and making Chomp require nightly #50

m4rw3r opened this issue Aug 28, 2016 · 3 comments

Comments

@m4rw3r
Copy link
Owner

m4rw3r commented Aug 28, 2016

Using conservative impl Trait we can change Chomp from being a monad-like parser-combinator into a full-fledged monad. Current development can be found in the https://github.com/m4rw3r/chomp/tree/experiment/impl_trait branch.

The monad has several benefits; macro is simpler, parsers are easier to compose due to not being forced to pass around the input state, simpler type-signatures for more complex parsers (associated types) and so on. The downside is that it currently only works on nightly rust and is incompatible with the current (0.2.6) version of Chomp.

The question here is what to do with the monad-like version of Chomp? I am committed to finishing up version 0.3.0 of Chomp using the monad-like parser using an Input trait which is compatible with the Input trait of the monad version (if you change a few method names). The contents of the buffer module are also largely unchanged between the two.

I see two choices here:

  • Let 0.x.y versions of Chomp be monad-like, and release a monad-like 1.0.0 when it is equal to the functionality of Attoparsec, leaving 2.0.0 and up for the monad version which will require nightly until impl Trait has been stabilized.
  • Release the monad version under a new crate-name (eg. chomp2)

Essentially this boils down to the question: How important is support for stable rust for users of Chomp?

@dashed
Copy link
Contributor

dashed commented Aug 31, 2016

I'm assuming you're following semver, I'm putting my 'vote' for the first choice; so long as docs of 1.x.z and 2.x.z versions are accessible. (e.g. like what hyper does http://hyper.rs/hyper/v0.9.1/hyper/index.html)

You could publish Chomp requiring nightly features with -alpha/-beta suffixes (e.g. 2.x.y-alpha / 2.x.y-beta), and then remove the suffixes until the required rust versions become stable. Note that, 2.x.y-alpha < 2.x.y-beta < 2.x.y, see: https://github.com/steveklabnik/semver#versions and http://semver.org/


IMO, I use nightly rust, so I'm fine with using Chomp if it requires nightly stuff.

@m4rw3r is there a particular choice you're leaning towards?

@m4rw3r
Copy link
Owner Author

m4rw3r commented Aug 31, 2016

@dashed The main issue is that the impl Trait version would for the most time never compile under stable rust, and that is mainly focused around the core parts of it, so the -alpha and -beta suffixes would sadly not work. Good point about the documentation, I will have to make sure that both are reachable (and probably noted in the readme with links to the proper branch(es) so that people can find the correct resources).

I'm leaning towards having the 1.y.z being the monad-like verison (ie. current implementation without impl Trait which works on stable) and 2.y.z being the monad version which will require nightly for all or most of its features.

@m4rw3r m4rw3r added this to the Version 2.0.0 milestone Sep 2, 2016
@m4rw3r
Copy link
Owner Author

m4rw3r commented Sep 6, 2016

Closing in favor of #53 which will become Chomp 2.0.0

@m4rw3r m4rw3r closed this as completed Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants