2010/9/23 Cédric Beust ♔ <[email protected]> > > > On Wed, Sep 22, 2010 at 4:44 PM, Josh Suereth <[email protected]>wrote: > >> I think it's fair to say that this is more expressive than Java exceptio > > > More expressive, maybe, but certainly less useful: the problem with Either > is that while it hides the exception inside the monad and possibly short > circuit the rest of the expression (I don't even think it does actually > since the compiler can't know if a None value is an error or not), it still > lets the execution of the rest of the code happily continue after that.
None (along with Some) is a subclass of Option (aka `Maybe` in Haskell/F#) Right and Left are the two subclasses of Either So `None` can never, ever be returned when the signature of a method specifies Either<FileHandle, Exception> as the return type. (note: these features aren't in any way special to Scala, they're a general feature of statically-typed languages with FP support, including Scala, Haskell and F#) > The advantage of an exception is that it blows up right away and then > bubbles up until it gets caught by a handler that knows how to deal with it. > I'm in total agreement. I only ever expressed concern about things being checked exceptions that probably shouldn't be Exceptions at all, but are forced into it as Java offers no suitable alternative mechanism, > Like Reinier, I don't quite understand how we came to compare the merits of > returning error codes versus throwing exceptions, because frankly, this > debate was settled more than a decade ago and exceptions won. > Of course they did, and rightly so! It's just *checked* exceptions that have failed > -- > 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]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- Kevin Wright mail / gtalk / msn : [email protected] pulse / skype: kev.lee.wright twitter: @thecoda -- 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.
