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

Reimplement as procedural macro? #42

Closed
inodentry opened this issue Dec 9, 2018 · 3 comments
Closed

Reimplement as procedural macro? #42

inodentry opened this issue Dec 9, 2018 · 3 comments

Comments

@inodentry
Copy link

quick-error is by far my preferred error handling solution in Rust. I like it more than failure or error-chain. However, it is a shame that its functionality is limited due to limitations of the macro_rules syntax. For example: lack of generics support (issue #20). Also: poor error messages.

I believe these issues could be resolved if quick_error was implemented as a procedural macro, which is now stable as of Rust 1.30. This would greatly improve the usefulness of the crate, at least for projects that don't mind the 1.30 minimum Rust version requirement.

It could be released as a new semver-incompatible version to avoid bumping the minimum Rust requirement of old code that depends on this crate to 1.30 due to automatic upgrade.

@tailhook
Copy link
Owner

tailhook commented Dec 9, 2018

Hi! While I have nostalgia to the quick-error I don't think it makes sense to continue developing the crate. Using derives and attributes like in failure makes much more sense nowadays. This is even more true with current attempts to move important parts of failure crate into stdlib and maybe even provide generic derive(Display) in stdlib.

Also, given the trade-off we've made here because of the limitations of macros and because major version bump is needed anyway, the new library can be designed from the ground up wih nicer syntax and modern semantics.

@inodentry
Copy link
Author

Fair enough. I understand.

I just personally dislike failure, because it does not derive From impls (which makes it very impractical) and also bundles a fancy Error abstraction with backtraces, etc, which I find unnecessarily complex to bring into everything. I like the simplicity of this crate. It just simply derives what I want.

I hope that whatever makes it to the stdlib in the future is a good replacement in the same minimalist spirit.

Do you, by any chance, know where activity about these "current attempts" at improving error handling is happening? Could you point me to the right place? Maybe I could contribute.

@tailhook
Copy link
Owner

I just personally dislike failure, because it does not derive From impls

Yes, there is an issue about it. Maybe you can upvote it or maybe derive_more crate is better? (i.e. more fine grained control)

also bundles a fancy Error abstraction with backtrace

It's only if you use failure::Error type which is not requirement. I use Fail for most library errors. Only unrecoverable errors might carry a traceback and the cost isn't much in this case (e.g. restarting process is much more expensive anyway)

Do you, by any chance, know where activity about these "current attempts" at improving error handling is happening? Could you point me to the right place? Maybe I could contribute.

Perhaps, this is the right entry point.

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