From: Nit Khair Date: 2008-10-02T21:48:49+09:00 Subject: Re: "ensure" hiding actual error Dave Thomas wrote: > On Oct 2, 2008, at 7:39 AM, Nit Khair wrote: > >> I spent many years in Java where the style was: >> >> try { >> resource = init_resource >> } catch (exception) {} >> finally { >> if resource != null { resource.close } >> } > > This is common in Java, but it is incorrect. > > What happens if init_resource() throws an exception? > > > Dave Oops I forgot to mention that in finally {} one would check for resource not being nil. Corrected above. -- Posted via http://www.ruby-forum.com/.