Skip to content

Instantly share code, notes, and snippets.

@yllan
Created November 11, 2010 08:41
Show Gist options
  • Save yllan/672209 to your computer and use it in GitHub Desktop.
Save yllan/672209 to your computer and use it in GitHub Desktop.
Higher Order Function
typedef id(^TestBlock)(id);
TestBlock (^blockForModificationType)(NSString *) = ^(NSString *type) {
return (TestBlock)[[^(id obj) {
if ([[obj modificationType] isEqualToString: type]) return obj;
return (id)nil;
} copy] autorelease];
};
@yllan
Copy link
Author

yllan commented Nov 11, 2010

Oh, no, it's because the returned block is live on local stack!

@yllan
Copy link
Author

yllan commented Nov 11, 2010

Now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment