I was reading A Tour of Scala: Abstract Types. When is it better to use abstract types?

For example,

abstract class Buffer {
  type T
  val element: T
}

rather that generics, for example,

abstract class Buffer[T] {
  val element: T
}

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *