zinc icon indicating copy to clipboard operation
zinc copied to clipboard

Scala 2.12 support: trait compiles to an interface

Open eed3si9n opened this issue 8 years ago • 1 comments

  • http://www.scala-lang.org/blog/2016/07/08/trait-method-performance.html
  • http://www.scala-lang.org/news/2.12.0-M5
  • scala/scala#5085 SD-98 don't emit unnecessary mixin forwarders

In most cases when a class inherits a concrete method from a trait we don't need to generate a forwarder to the default method in the class.

This means we could skip the invalidation of classes extending traits in most cases.

notes

https://github.com/scala/scala/pull/5085#issuecomment-206929863

after this patch there are two situations where a trait forwarder is emitted:

  1. a class inherits the same method from two traits, and the two traits are not in a inheritance relationship.
  2. a class inherits a concrete method from a trait, and the same method also exists (abstract or concrete) in a superclass.

eed3si9n avatar Aug 27 '16 18:08 eed3si9n

Isn't the forwarders situation the reason for the slowdown in scalac?

Perhaps we should wait for that to shake out before spending time on it in zinc.

On Sat, 27 Aug 2016, 20:41 eugene yokota, [email protected] wrote:

http://www.scala-lang.org/blog/2016/07/08/trait-method-performance.html

  • http://www.scala-lang.org/news/2.12.0-M5
  • scala/scala#5085 https://github.com/scala/scala/pull/5085 SD-98 don't emit unnecessary mixin forwarders

In most cases when a class inherits a concrete method from a trait we don't need to generate a forwarder to the default method in the class.

This means we could skip the invalidation of classes extending traits in most cases. notes

scala/scala#5085 (comment) https://github.com/scala/scala/pull/5085#issuecomment-206929863

after this patch there are two situations where a trait forwarder is emitted:

a class inherits the same method from two traits, and the two traits are not in a inheritance relationship. 2.

a class inherits a concrete method from a trait, and the same method also exists (abstract or concrete) in a superclass.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sbt/zinc/issues/168, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVCIoQRNrqqZVyqe1avqMrW4BK6YfWMks5qkITlgaJpZM4Juwa6 .

dwijnand avatar Aug 29 '16 07:08 dwijnand