|
|
|
|
|
by yason
5271 days ago
|
|
Thanks, I didn't realize it's this bad. My only touch base with Java has been through Clojure. This is just horrible. What braindead system forces you to check exceptions on closing a file handle? If everything failed silently and just produced 'null', the code would look like: InputStream in = new FileInputStream(new File("test.txt"));
if (in) {
...dostuff...
in.close();
}
Now, that you can grasp with one glance. I'll trade the ability to write something like that with having to use malloc()/free() any day. |
|
How is the user supposed to figure out what went wrong with the program if the program can't even convey to the user what went wrong?
Complex problems have lots of simple wrong answers.
(Your "solution" also suggests nothing about how "in.close()" is going to get called if "...dostuff..." itself throws an exception.)