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

前端 未结 7 1290
灰色年华
灰色年华 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:45

    Might I just argue in favor of your existing approach, Some("callbackUrl")? It's all of 6 more characters for the API user to type, shows them that the parameter is optional, and presumably makes the implementation easier for you.

提交回复
热议问题