Remove NameOps implicit class (syntax extension)#8535
Remove NameOps implicit class (syntax extension)#8535diesalbla wants to merge 1 commit intoscala:2.13.xfrom
Conversation
|
This is going to break Scala.js. Can't we just put these methods in |
The NameOps implicit class is used to provide some extension methods to the Name classes and subclasses. However, because of some problem of outer references (being defined in a cake slice) they could not be turned into a plain `AnyVal`, so there was an allocation cost to them. While that allocation cost was not significant (0.2%), it is easily avoidable, with some syntactic salt and vinegar.
940d51b to
e015b83
Compare
What would break Scala.js in particular? The removal of the existing implicit class (or implicit methods and extension class)? If so, perhaps they could be kept.
I do not know if those methods can be added to the |
|
See 724b0dc for its introduction. I think with the deprecation of the |
Yes, basically the fact that it's a source-incompatible change that affects the Scala.js compiler plugin. It's nothing dramatic (the compiler breaks source compat from time to time and we have to adjust) but in this case I believe the change is a real regression in terms of API quality, so I wanted to point out that it was going to affect other codebases. The best would be to move the methods directly on |
|
Oh, yes, I remember why this is needed: there's an implicit conversion |
|
Haven't those |
@sjrd Could you open a Pull Request to that effect? I would like to keep this PR on the performance concern. |
|
I'll have a go if @sjrd doesn't have time, maybe because he's working on that thing I said I'd do and never did. The implicit conversions are part of the public API; is it within our compatibility policy to make them no longer implicit? |
|
@hrhino So, i will change the PR to avoid removing existing methods (or marking them as |
|
#8537 has successfully performed the op to surgically excise |
The
NameOpsimplicit class is used to provide some extension methods to the Name classes and subclasses. However, because of some problem of outer references (being defined in a cake slice) they could not be turned into a plainAnyVal, so there was an allocation cost to them.While that allocation cost was not significant (0.2%), nevertheless it is easily avoidable, by just adding some syntactic salt and vinegar to our cake.