Unfamiliar trait import syntax


#1

Hi fellows i have a question, i am unfamiliar with the following syntax, what does it mean

trait MyExpressions {
//stufff
}    
trait MyScheduler {
  val IR: MyExpressions
  import IR._
//stufff
}

what does the following code achieves?

    val IR: MyExpressions
    import IR._

and is it an old syntax? if so what is the modern version?

Thanks


#2

That is the usual syntax to import members of IR.


#3

It means that if IR, for example, has a member x, you can now write x instead of IR.x.

IR is unusual in that vals usually are written lowercase.


#4

but MyExpressions is not a supertype of MyScheduler right?
Thanks


#5

Right, it is not.


#6

Don’t know if it counts as unusual, but it’s also abstract. There’s no such abstract fields in Java, for instance.