Skip to content

Instantly share code, notes, and snippets.

@markd2
Created December 18, 2018 15:30
Show Gist options
  • Save markd2/722e1f57f173f1a045e63d3fa5c59dd2 to your computer and use it in GitHub Desktop.
Save markd2/722e1f57f173f1a045e63d3fa5c59dd2 to your computer and use it in GitHub Desktop.
Does `copy` really strip off mutability?
#import <Foundation/Foundation.h>
// clang -g -framework Foundation -o mute mute.m
int main(void) {
NSMutableString *blarg = NSMutableString.new;
NSString *copy = blarg.copy;
NSLog(@"%@ | %@", blarg.class, copy.class);
return 0;
}
#if 0
% clang -g -framework Foundation -o mute mute.m
% ./mute
2018-12-18 10:30:27.461 mute[84191:14368442] __NSCFString | __NSCFConstantString
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment