Open milessabin opened 9 years ago
@milessabin is it important that they would be a trait? I haven't found myself wanting this functionality, but if we were to make this change I was wondering if an abstract class
would suffice, as it would allow methods to be added to the transformer without breaking binary compatibility.
Hmm actually these would be non-final, but they wouldn't be abstract at all, would they? Would it just be a class?
A class is just fine.
Isn't it possible to define a value alias for the companion object?
It is, but it wouldn't be considered as part of the implicit scope.
What's the status on this? Are there any reasons not to make transformers non-final?
cc @kailuowang @LukaJCB
The implicit search scope includes the object where the alias is defined. So there is less need for an official companion object. That is you can define instances in the same object where alias is defined.
It's common to want simple names for transformer stacks, eg.,
Type aliases are somewhat second class in Scala however. In particular they don't have proper companion objects, and objects of the same name aren't searched for corresponding implicit definitions.
If transformers were non-final it would be possible to define a trait rather than a type alias,
In which case a useful companion object would be a possibility.