Ryan Williams
2016-12-07 03:26:24 UTC
The requirement that implicit classes be explicitly declared inside another
object gets in my way frequently and feels like it could be relaxed.
My typical library code looks like:
package foo.bar
object Baz {
implicit class Baz(âŠ) { ⊠}
}
and corresponding calling code:
import foo.bar.Baz.Baz
One of the two Baz-layers is redundant.
Logically, i want my implicit classes to be considered to live inside their
nearest containing package object (in this case foo.bar), just like
non-implicit classes, but I can only declare a given package object once,
so to use it I have to put all classes in a package in the same file (in
the package object), which is also suboptimal.
LMK if I'm missing something? Thanks!
object gets in my way frequently and feels like it could be relaxed.
My typical library code looks like:
package foo.bar
object Baz {
implicit class Baz(âŠ) { ⊠}
}
and corresponding calling code:
import foo.bar.Baz.Baz
One of the two Baz-layers is redundant.
Logically, i want my implicit classes to be considered to live inside their
nearest containing package object (in this case foo.bar), just like
non-implicit classes, but I can only declare a given package object once,
so to use it I have to put all classes in a package in the same file (in
the package object), which is also suboptimal.
LMK if I'm missing something? Thanks!
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.