m4rw3r / chomp

A fast monadic-style parser combinator designed to work on stable Rust.
Apache License 2.0
243 stars 19 forks source link

`impl Trait` and making Chomp require nightly #50

Closed m4rw3r closed 8 years ago

m4rw3r commented 8 years ago

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:

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

dashed commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

Closing in favor of #53 which will become Chomp 2.0.0