[Interest] Args

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon May 8 13:26:41 CEST 2017



Am 08.05.2017 um 07:16 schrieb Philippe <philwave at gmail.com>:

>>> There is probably a reason why completely new languages like Swift come
>>> completely without exception handling 
> 
> Quote from Apple doc:
> 
> "Swift provides first-class support for throwing, catching, propagating,
> and manipulating recoverable errors at runtime."
> 
> https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html
> 

Interesting. That must be a "recent addition to Swift (3.0?)", as that clearly wasn't there from the very beginning (hence the outcry in the former ObjC community).

This sticks out for me:


"Note: Error handling in Swift resembles exception handling in other languages, with the use of the try, catch and throw keywords. Unlike exception handling in many languages—including Objective-C—error handling in Swift does not involve unwinding the call stack, a process that can be computationally expensive. As such, the performance characteristics of a throwstatement are comparable to those of a returnstatement."

But yes, for all practical matters that means that Swift has exception handling now :)


But then there's another new language Go which also "got rid" of exceptions (because it can "afford to": it doesn't have a huge legacy API like Cocoa/ObjC to satisfy) from the very beginning:

https://dave.cheney.net/2012/01/18/why-go-gets-exceptions-right

That's a nice read btw which I just found.

This sums up my previous point pretty nicely:

"Java exceptions ceased to be exceptional at all, they became commonplace. They are used from everything from the benign to the catastrophic, differentiating between the severity of exceptions falls to the caller of the function."

;)

Cheers,
  Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170508/0f6d2ee5/attachment.html>


More information about the Interest mailing list