On Thu, 25 Oct 2012 20:59:21 +0200, Ricky Clarkson
<[email protected]> wrote:
Option is a type born to support some constructs,
such as avoiding null.
That's just as correct as saying that array is a type born to support
some constructs, such as avoiding declaring 10 variables. I.e., it's
not correct.
Both Option.none and null can be used to denote that an item is not
present, but so can having an empty string, an empty list, the text
"undefined" and all sorts of other approaches, some of which might
make sense given a scenario, but that doesn't mean Option is like null
any more than null is like "", or null is like 0, -1, false,
"unknown", NaN, etc.
What I see is that without an array I can't do many things (10 variables,
of course, aren't the same as an array). I can live without Option, using
null. I'm not saying that null is better or worse - I don't want to
discuss this now. I'm saying that Option is one of the many ways to
represent the lack of a datum. In this sense, I completely agree to your
last paragraph, and this further consolidates in my mind that Option is a
totally different thing than a String, or any other type.
--
Fabrizio Giudici - Java Architect @ Tidalwave s.a.s.
"We make Java work. Everywhere."
http://tidalwave.it/fabrizio/blog - [email protected]
--
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.