SIP Suggestion: Add ?: and ?. syntactic sugar for more convenient Option[T] usage


I like this.But what type should be TypeName? it’s a TypeName | Null or Option[TypeName]?


@sjrd: I like your a: String? definition / clarification, that would be a nice addition to Scala.

Given the feedback in this thread, how about we proceed with a: String? and drop ?.?

(Separately, I wish we could drop the x: _* syntax (not the functionality) - I’ve never found it clarifying, and I use it just rarely enough to not always remember what it should be. Note that e.g. Java lets you pass an array in place of a vararg - very convenient)


Why not just create:

type OptStr = Option[String]
type OptInt = Option[Int]
type OptDou = Option[Double]
type OptBool = Option[Boolean]