[swift-users] "business applications market" flame

Jens Alfke jens at mooseyard.com
Thu Jan 7 15:00:28 CST 2016

> On Jan 7, 2016, at 12:27 PM, Brent Royal-Gordon via swift-users <swift-users at swift.org> wrote:
>> IMO, Java has it right - let the API designer decide which approach to take.
> That's a frankly laughable misreading of the Java story. The Java story is that they wanted everyone to use checked exceptions, but the users loathed them so much that they found hacks to get around the checked exception system

+1. Been there, done that :)

Another factor is that in the Java (and C++) environment, nearly anything can fail, since ‘new’ can throw an OutOfMemoryError*, and programmer mistakes like out-of-range array indexes or failed type-casts are treated as theoretically-recoverable exceptions. Therefore nearly any nontrivial method can potentially throw, so having unchecked exceptions is a requirement or else all of those methods would have to be labeled as ‘throws’.

This is in contrast with Swift (and Go) where errors are higher-level — things like I/O errors — while assertion failures will unconditionally abort. This makes program logic a lot easier to follow, since the jumps caused by exceptions are notoriously unintuitive (being a form of invisible goto.)


* This was reasonable in the 1990s, but makes little sense in the OSs most of us code for today, on which malloc() will pretty much never return NULL. (Embedded OSs are an exception.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160107/d5845faa/attachment.html>

More information about the swift-users mailing list