Description
Today we do some amount of defaulting to cover two special cases:
~Trait => ~Trait:Send
proc => proc:Send
This means that you must write ~Trait:
and proc:
to bypass these defaults.
I think we should consider removing these defaults and be consistent: no bounds means no bounds.
Arguments in favor of defaults:
- Less typing for the common case of sendable
~Trait
objects andproc
Arguments against:
-
We don't generally default other places in the language
-
proc:Send
and~Trait:Send
read quite clearly to me -
The fact that
proc:
is even an option is not obvious, leading people to the false conclusion that one cannot e.g. close over borrowed values in a proc -
There are other use cases for
~Trait
andproc
that don't involve sending -
Defaults are somewhat confusing in the face of DST. Consider these types:
struct Foo<A> { x: ~A } struct Bar<A> { x: A }
Wouldn't you think that
Foo<Trait>
andBar<~Trait>
should be equivalent?
I would, but they're not.