Last active
August 29, 2015 14:16
-
-
Save tolmasky/00eaa5e056b6637b7c18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setArray:(NSArray *)anArray | |
{ | |
_myArray = anArray; // aha! subtle bug because anArray MAY be a mutable array, so you need to do [anArray copy]. With the magic of inheritance, the type system becomes confusingly worthless, telling you that yes, a mutable array is an immutable array. Yay for confusing first time programmers! | |
} | |
// This problem exists EVERYWHERE: | |
- (void)doSomethingWithView:(NSView *)aView | |
{ | |
[aView addSubview:controlView]; // This may or may not work depending what aView is. Despite the docs telling you that addSubview is a perfectly fine PUBLIC API, subclasses of NSView may make it effectively private, thus breaking here. So what's the point of saying "give me a view" if subclasses of NSView can willy-nilly change the exposed API? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment