outcome
outcome copied to clipboard
remove reference to value/error when unwrapping outcome
This might need to be a new method for backwards compatibility, since the attributes are public, users would be able to still read them after unwrapping. Unless we're fine with that breaking change.
could just call it InvalidatingOutcome, InvalidatingError and InvalidatingValue
A parallel class hierarchy seems problematic, they'd be incompatible with the current ones. More thinking like unwrap_and_clear(), that's all we need.
Would using a weak reference not be acceptable?
Would using a weak reference not be acceptable?
I think that would be more complicated and it would be odd that unwrapped values are sometimes there sometimes not and not everything can be weakref'd
I'm -1 on deleting public attributes during unwrap. I don't like that accessing an attribute/property may raise, but if we go that route then I'd much prefer AlreadyUsedError over AttributeError.
The way I've always used outcome is to only .unwrap() or .send(), so I would be fine with an outcome 2.0 that doesn't have the attributes, but I know Trio does use them.