News for hackers. Stuff that matters.
Re:PHP doesn't need 'finally' by yummyfajitas on Friday December 10, 2010 @08:54AM (#1991610)
In this case, do_something_finally() will never be called.

    try {
        throw new IOException("bad");
    } catch ( NotAnIOException e) {
        System.out.println("This is something I expected to happen.");
    }
    do_something_finally();
With a finally block, it would be, and the IOException would then be bubbled up to the caller. Without finally, you need to do this:

    try {
        throw new IOException("bad");
    } catch ( NotAnIOException e) {
        System.out.println("This is something I expected to happen.");
    } catch (Exception e) {
        do_something_finally();
        throw e;
    }
    do_something_finally();
Re:PHP doesn't need 'finally' by dan_netwalker on Tuesday December 14, 2010 @01:12PM (#2005077)
Thanks, now that has a lot more sense