Why is the Scala Option type not called Maybe, just as in Haskell?
Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of.
Is there any particular reason why Option in Scala was not called Maybe?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityWhy is the Scala Option type not called Maybe, just as in Haskell?
Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of.
Is there any particular reason why Option in Scala was not called Maybe?
Scala is also inspired by Ocaml, which uses Option.
Options are an Ocaml standard type that can be either
None
(undefined) orSome x
where x can be any value. Options are widely used in Ocaml to represent undefined values (a little like NULL in C, but in a type and memory safe way)...
I think the name chosen is a matter of taste.
Maybe
Option
is that it's an optional
value (either you get it or you don't). Maybe
implies some degree of uncertainty on the programmer's part. Maybe there is a value? I don't know.. Should I get a value? The wording optional value
sounds more intentional in my opinion.
Aug 27, 2019 at 15:20
A better question here would be why Haskell's option type is called Maybe
. ML's option type is probably the grandaddy of all option types, and it's called option
.
In any case, this is a terminological question, so it's not going to have a principled answer. The people who picked the name in Haskell liked it better, that's it.
option
is an abbreviation for optional
. In which case the (multiple) choices are reduced to just two: either it's there or it isn't.
Aug 27, 2019 at 15:25