I think original proposal that omits assignment operator in typeclass instance definition has some drawbacks.
- Implied instance definition looks almost the same as implied alias definition:
implied instanceDefinition for A[B] { ... }
implied aliasDefinition for A[B] = { ... }
Only one non-blank char of difference. Just like with method returning Unit and method with inferred types:
def methodReturningUnit { ... }
def methodWithInferredReturnType = { ... }
Notation for methods without assignment operator was dismissed on many reasons and the imposed alternative is to replace def method { ... }
with def method: Unit = { ... }
which is 6 non-blank characters longer. Remember that methods returning Unit are quite frequent.
- Conflict between abstract implied instances and short class notation.
Objects and classes definitions can omit curly braces if there’s nothing to add or change in object / class definition, i.e. we can write:
class A // {} not needed
class A extends B // {} not needed
object A // {} not needed
object A extends B // {} not needed
If implied instances notations are analogous to objects and classes notations then following lines would mean concrete definitions, not abstract members:
implied A
implied A given B
But then how to define abstract implied instances?
abstract class TypeclassesAggregate {
implied A // does not look like abstract member
abstract implied B // well, here 'B' refers in fact to method name, but methods don't need 'abstract' modifier
}
If we always require =
(assignment operator) in implicit instances definitions then above problems don’t exist or are reduced.