2011/3/25 Cédric Beust ♔ <[email protected]> > > > On Fri, Mar 25, 2011 at 4:33 AM, Josh Berry <[email protected]> wrote: > >> With Either types and proper usage of map/flatMap >> (usually in a for comprehension), the errors are easy to propagate up >> where they can be dealt with correctly. >> > > Either types help with the "wrapping the information" aspect, which is > undoubtedly superior to a HRESULT or encoding errors in variants ("ok, > result = Foo()" that Go and Erlang seem to love so much). > > However, Either types do nothing for the propagation: you still end up > having to 1) have all your methods return an Either type and 2) do the > bubbling up yourself. >
As opposed to: "you still end up having to 1) have all your methods declare they could throw the exception or b) having to wrap it, most likely in some generic RuntimeException, thus losing valuable type information from your method signatures" And what exactly is "doing all the bubbling yourself" if it isn't having all relevant methods return an Either? > > I want the language to take care of 2) for me and for 1), a `throws` > signature is a much more sensitive place to identify the potential errors > that can happen than the return type, which I'd like to save for my own > usage. > > -- > Cédric > > > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- Kevin Wright gtalk / msn : [email protected] <[email protected]>mail: [email protected] vibe / skype: kev.lee.wright quora: http://www.quora.com/Kevin-Wright twitter: @thecoda "My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
