Closed ExpHP closed 6 years ago
Hmm; Rather than doing this (and since we introduced some other breaking changes in master), I'd like us to get rid of CNil
and simply use !
(assuming we can do it wrt. coherence, which I think we can), this is what the standard library has been doing as of late, and the hope is that !
should be the only uninhabited type in the entire ecosystem.
I'd personally like to have:
#[lang_item = "never"]
impl ! {
pub fn absurd<T>(self) -> T {
match self {}
}
}
in the standard library tho.
Okay. Do note that this will prevent inherent method wrappers (#90) on empty coproducts. That said, in most cases not having these methods is not a huge loss (most have no implementations for CNil, and who needs to take a subset()
of a coproduct that is monomorphically known to be empty?); rather, it's just one of those places where the ergonomic hack will become a leaky abstraction.
(for instance, it could be an issue for code generated by macros)
Okay. Do note that this will prevent inherent method wrappers (#90) on empty coproducts. That said, in most cases not having these methods is not a huge loss [..]
Yeah sounds fine ^,-
Do you mean that not having the wrappers on CNil sounds fine? Or that keeping CNil around sounds fine?
Sorry, I meant the former.
Okay, I'll close this for now.
Dangit, I'm having too many ideas all at once now!
Bikeshedding for the name is welcome. The name
absurd()
comes from proof solvers. Picture it appearing e.g. at the bottom of this example, or as the body of this impl. (random aside: uh... why is that impl#[doc(hidden)]
?)