Created
October 27, 2010 17:53
-
-
Save landonf/649576 to your computer and use it in GitHub Desktop.
An Objective-Not-C with type inference might look like ...
This file contains hidden or 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
@implementation Logger | |
- (void) writeToLog: (NSString) message { | |
NSLog("%@", message); | |
} | |
@end | |
/* infer the types */ | |
val printer = ^(str) { | |
[self writeToLog: str]; | |
} | |
vs. | |
/* explicitly declare the types */ | |
void (^printer)(NSString *) = ^(NSString *str) { | |
[self writeToLog: str]; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment