Passing true optional arguments to functions

I am using this technique in a codebase at work and liking it: Scala Option symbolic syntax

It allows things like:

// Using type ?[A] instead of Option[A]
def age(years: ?[Int] = None): String = ...

// Using expr.? instead of Some(expr)
println(age(10.?))
1 Like