dotty-feature-requests icon indicating copy to clipboard operation
dotty-feature-requests copied to clipboard

Export more stuff from this

Open som-snytt opened this issue 4 years ago • 0 comments

I'd like to export a member with rename, in the manner of @targetName.

object Stuff:
  def f = ???
  export this.{f => g}

I'd like to export an opaque type in order to make it transparent, with the alias opaque by default. (-Yopaque-by-default?)

object Stuff:
  /* opaque */ type Name = String
  export this.Name
object other:
  val n: Stuff.Name = "hello, world"

I'd like to export my companion, where a companion is nested instead of sibling.

class Stuff:
  def f = ???
  object Stuff:
    def g = f  // obviously not, context of companion is as usual
  export this.Stuff  // named companion is available
  object Staff
  export this.Staff  // error: not a companion
  export this.{Staff => Stuff}  // not a companion
  object:            // anonymous companion! which is more natural for implicits/givens, no danger of typo
    def apply() = ???
    given ...
object other:
  Stuff.m  // normal companion reference, not Stuff.Stuff.m

som-snytt avatar Nov 19 '20 22:11 som-snytt