+1 but:
I'm somewhat hesistant about not marking the plausibly discarable ones @discardableResult. - I rarely use the result value of removeLast() and I don't see how requiring it here adds any safety. It is obvious this call has side-effects and doesn't just return the last element. - I would say the canonical way to clean-up observers would be to call removeObservers(self) in deinit to remove all of them at once. Though arguably not marking it @discardable might have some small safety benefit here.
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
