error-chain
error-chain copied to clipboard
Redesign syntax as a proc macro
trafficstars
There are a lot of deficiencies with the current syntax that are pretty hard to resolve as a macro_rules macro:
- Make it possible to attach attributes to Error and ErrorKind types
- Make it possible to attach visibility specifiers
- The syntax not matching corresponding declaration form
- The types declaration, with its hand-rolled system of defaults, doesn't quite feel "rustic"
- Attributes only coming after items
- No ability to place attributes or visibility modifiers on
ErrororErrorKind - No ability to use generics in error variants
- Cannot document fields in struct type error
- Cannot currently use
deriveon the Error type - Links with custom description/display
- Make it possible to specify Send / Sync
- I personally think it should be send / sync by default
This is a lot of constraints and demands a complete redesign.
Maybe take inspiration from/merge with https://github.com/Arnavion/derive-error-chain
Previous discussion of merging derive-error-chain into this repository is at https://github.com/Arnavion/derive-error-chain/issues/11
If the goal is to completely replace the existing macro_rules macro with a custom derive, then my concerns in that issue do not apply and I would be happy to merge its code here.