July 14, 2015
On 2015-07-14 18:53:31 +0000, Jacob Carlborg <doob@me.com> said:

> Hmm, I see. I imagined something similar would need to be done for the new exception handling in Swift 2, but for every method, that was unexpected. Now when Swift goes open source someone can just have a look and see what's going on :)

I'd be surprised if error handling had something to do with those thunks (they were there in Swift 1.2 after all). Error handling in Swift 2 is mostly a lowering of Cocoa's NSError handling pattern merged into the calling convention, where the compiler generates the necessary code in each function to propagate errors.

Objective-C exceptions are still fatal errors when they reach Swift 2 code.

I think those thunks are simply there so that Swift code can use Swift calling conventions everywhere, which makes things simpler on the Swift side and enables some optimizations that would not be allowed with Objective-C.

-- 
Michel Fortin
michel.fortin@michelf.ca
http://michelf.ca

1 2 3
Next ›   Last »