3 ms·
Hmm...I am not sure what difference the author is making between closures and blocks, the terms at least overlap substantially. For example, Smalltalk blocks h
by mpweiher 12y ago
Hmm...I am not sure what difference the author is making between closures and blocks, the terms at least overlap substantially.
For example, Smalltalk blocks have been "upgraded" to closures in most dialects (and not implementing them as closures in the first place was not a choice of semantics, but one of implementation simplicity).
Also, Swift closures are the same as Objective-C blocks.
+(void)logMe: (void (^)(void))block
{
NSLog(@"object of class: %@",[(id)block class]);
}
Called from Swift with a closure:
func applicationDidFinishLaunching(aNotification: NSNotification?) {
logger.logMe( { } );
}
Results in:
2014-06-30 19:55:37.973 SwifTest[94782:303] object of class: __NSMallocBlock__
So much ado about nothing?