Call for reviewers on standard way to define extension methods


#1

There’s an open PR that adds new ways to define extension methods to the Scala tour: https://github.com/scala/docs.scala-lang/pull/1117#issuecomment-411159531

I’d like to encourage people to leave some comments and try to find consensus on the preferred way to define extension methods in Scala. I think it would be beneficial if we could recommend just one approach or agree on some defaults (like defining extension methods in an object or package object called syntax that then can be imported in the call-site.


#2

To leave comments here or on the PR?

What are the choices that need deciding?

On thing I would point out is that if the name of the implicit class is based only on the name of the wrapped class (e.g. RichXXX), you can’t import multiple of them. Recently I’ve adopted a convention I’ve seen somewhere which involves making the name more distinct, like Int_toHexString.

I’m not sure if it matters if it’s just in the implicit scope.