On Tue, Oct 30, 2012 at 10:14 PM, Cédric Beust ♔ <[email protected]> wrote:
> It depends on the functions that you are calling in the Some and None cases:
> if they belong to an external API, extracting the value is your only opt...
> er... choice. However, if you are calling methods that you wrote, consider
> rewriting them to accept an Option and just call flatMap with that method on
> your option.

They were external.  In both cases they were a direct call to the x
object.  (So, case Some(x:..) => x.someMethod)

Though, I am surprised to see it suggested to make methods take in an
Option type.  I thought the general rule was to make the functions
take in the non option, and then use map/flatMap to deal with when
their are options.  (Unless, of course, your function does something
different when there is a None, I suppose.)

And, in all of this, I have to confess my round one of console logging
was to just use printfs.  I definitely realize I am not exactly a
paragon of functional purity.  :)

-- 
You received this message because you are subscribed to the Google Groups "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.

Reply via email to