Maybe is good if something may or may not be there such in a dictionary lookup. The element not being available is a normal occurrence in that case.
In the case of errors it would hide what the actual error was. Peter Michael Neale wrote: > Or Maybe - (in which case you don't care about the None case, you just > need to handle it). > > On Aug 18, 6:43 pm, Peter Becker <peter.becker...@gmail.com> wrote: > >> In Scala you get the Either type. That is superior for most cases where >> one might use checked exceptions in Java. >> >> I have used that style in Java, but you usually don't make friends with it. >> >> Peter >> >> >> >> Michael Neale wrote: >> >>> What do people think of the scala approach of no checked exceptions - >>> even checked exceptions are not treated specially by the constructor >>> (personally, I like it). >>> >>> On Aug 18, 12:55 pm, Christian Catchpole <christ...@catchpole.net> >>> wrote: >>> >>>> No, i just let that go up. I really try to avoid the declare as null >>>> then set thingy. >>>> >>>> On Aug 18, 12:03 pm, Casper Bang <casper.b...@gmail.com> wrote: >>>> >>>>> You neglect to handle the checked exception declared by >>>>> prepareStatement no? >>>>> >>>>> PreparedStatement stmt = null; >>>>> try{ >>>>> stmt = connection.prepareStatement(sql); >>>>> final ResultSet rs = stmt.executeQuery(); >>>>> try{ >>>>> while (rs.next()){ >>>>> // Stuff... >>>>> { >>>>> } >>>>> finally{ >>>>> rs.close(); >>>>> }} >>>>> >>>>> catch(SQLException e){ >>>>> // Logging...} >>>>> >>>>> finally{ >>>>> try{ >>>>> stmt.close(); >>>>> } >>>>> catch(SQLException whoTheFuckCares){ >>>>> }; >>>>> >>>>> } >>>>> >>>>> Really, how many other ways are there to do it I wonder now? (Apart >>>>> from wrapping certain things, like the last try-catch clause in some >>>>> general purpose "closer util"?). >>>>> >>>>> /Casper >>>>> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---