Are Options and named default arguments like oil and water in a Scala API?

前端 未结 7 1302
灰色年华
灰色年华 2020-12-12 22:30

I\'m working on a Scala API (for Twilio, by the way) where operations have a pretty large amount of parameters and many of these have sensible default values. To reduce typi

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 22:54

    I was also surprised by this. Why not generalize to:

    implicit def any2Option[T](x: T): Option[T] = Some(x)
    

    Any reason why that couldn't just be part of Predef?

提交回复
热议问题