Currently ComResult<ComRc<T>> fails as ComRc would need a default value for type handling.
Instead of using Default::default we should define EmptyReturnValue or similar trait. We can have a blanket impl that delegates to Default::default if that is available. For other types this would allow us to implement a somewhat unsafe 'default value' for return values.
For example ComRc might instantiate ComRc that contains a null pointer. This invalidates the ComRc contract (of never being null) so implementing such Default value would be extremely unsafe - on the other hand if it is a very special EmptyReturnValue trait that is used only for (somewhat sane) uninitialized values it makes more sense.
The value() fn of that trait could also be unsafe to further mark it as being outside the usual invariants.
Currently
ComResult<ComRc<T>>
fails as ComRc would need a default value for type handling.Instead of using
Default::default
we should defineEmptyReturnValue
or similar trait. We can have a blanket impl that delegates toDefault::default
if that is available. For other types this would allow us to implement a somewhat unsafe 'default value' for return values.For example
ComRc
might instantiate ComRc that contains a null pointer. This invalidates the ComRc contract (of never being null) so implementing suchDefault
value would be extremely unsafe - on the other hand if it is a very specialEmptyReturnValue
trait that is used only for (somewhat sane) uninitialized values it makes more sense.The
value()
fn of that trait could also beunsafe
to further mark it as being outside the usual invariants.