Scala naming convention for options

When I return something like Option, it seems useful to explain in the name of the function name that this is an option, not the thing itself. For example, seqs have reduceOption. Is there a standard naming convention? What I saw:

maybeFunctionName

functionNameOption

- nothing seems so beautiful.

+5
source share
2 answers

reduceOptionand friends ( headOptionetc.) are called only in such a way as to distinguish them from their unsafe alternatives (which, perhaps, should not exist in the first place, i.e. there should only be one headthat returns Option[A]).

whateverOption ​​ ( Scala , ), Scala.

+13

, ? , , , .

reduceOption - , , , .

+7

All Articles