Can methods taking AnyObject
be safe?
#562
Labels
A-framework
Affects the framework crates and the translator for them
AnyObject
be safe?
#562
Methods like
NSAccessibilityElement::accessibilityElementWithRole_frame_label_parent
orNSResponder::insertTab
take&AnyObject
.This means that they can assume very little about the object, but that's usually fine, as it's only really used in user-implemented methods (I think?).
Can we allow such methods to be safe? What about if I were to pass a
&NSMutableString
? Would that still be safe because I/the method can't recover the mutable string, or would safety be broken here?Related is methods like
NSError::initWithDomain_code_userInfo
orNSAttributedString::initWithString_attributes
, which acceptNSDictionary<SomeKey, AnyObject>
, and expect the user to pass the correct type for a given key.Does
Foundation
assert that the attributes are the correct type? If so, can we allow these methods to be safe?The text was updated successfully, but these errors were encountered: