Updated Proposal: Revisiting Implicits

I forgot to reply about that part:

Indeed, the fact that we can’t anymore have abstract given definitions is an important limitation to me. I guess the problem is that it wouldn’t play well with the given instance definition syntax. Consider for example the following definition:

given foo: Foo

Is it an abstract definition, or an instance definition (whose members are missing and should cause a compilation error).

We wouldn’t have this limitation if we had to put an = between the lhs and the rhs of a given definition:

given foo: Foo // abstract given definition
given foo: Foo = ... // concrete given definition that requires a right-hand side

Also, one comment about the fact that we can define anonymous instances: we probably judge this capability from the eyes of programmers that are used to always having to write names for implicit instances, and probably see here an improvement because we’d have less things to write, but we lack experience with this feature to really estimate its cost. For example, I often find it useful to be able to refer to an implicit value from its term identifier. Typically, when an implicit value is not found and I need to understand the reason why, the ability to explicitly refer to one specific implicit value lets me see the problem if that value were picked. (I’m not sure I am clear…!)

Error reporting might worsen as well: how do we refer to an anonymous given definition in an error message? Here is an example. The nice thing with the “named” version is that the code produced by the error message is actual Scala code that can be copy-pasted.

5 Likes