Guideline for adding functionality without breaking binary compatibility.
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
To maintain binary compatibility we can't add new methods with default implementation to existing traits. However we can add new traits with those and have classes extending them.
For example, we want to add a new method to a Typeclass TC[F[_]]. we could either provide a syntax trait that provides that method like
trait BOps2 {
abstract class BOps2Ex[F[_], A](fa: F[A])(implicit val F: TC[F]) {
def newMethod ???
}
implicit def bops[F[_], A](fa: F[A])(implicit val F: TC[F]) = new BOps2Ex(fa)
}
If this new method cannot be provided as a syntax to the data types we can add an implicit class against the Typeclass itself.
In both case, we can't have any existing trait extend these new trait. We would need to have several objects in cats inherit this new trait explicitly including cats.implicits cats.syntax.all, etc.
We should decide on a strategy and document in guideline.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the binary-compatibility examples in the issue and the entry points it names: cats.implicits and cats.syntax.all. Decide and document a consistent strategy for adding methods through new syntax traits or implicit classes, including which existing traits and objects must not extend them. Done means the guideline records the agreed approach and examples clearly enough to apply to future changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100