error-chain icon indicating copy to clipboard operation
error-chain copied to clipboard

Unify links and foreign_links

Open brson opened this issue 8 years ago • 1 comments
trafficstars

It is claimed these two concepts can be unified with specialization. I don't know what that entails.

brson avatar Jul 24 '17 18:07 brson

Link is specialized by error type and error kind type while foreign_link is specialized by error type only. So there is a temptation to make a foreign link as a special case of a link. I've made an attempt here https://github.com/rust-lang-nursery/error-chain/compare/master...andy128k:feature/unify_links_and_foreign_links

My first impression is that this leads to the invention of extra macros and less readable and less maintainable code. This is caused by limitations of rust's macro tokenizer (and, BTW, this is the same reason why macro impl_error_chain_kind is bloated).

Even if this unification would be successful it will bring a feeling of "magic" and implicitness to library's API.

I would like to convince you, guys, to keep interface (and implementation) as-is. Or even move forward and migrate to proc_macro.

andy128k avatar Oct 12 '17 20:10 andy128k