Scala: Appointment. Like a feature suffix, for example. IndexSequenceLike

I see names ending in Likefor many types of Scala. What is the purpose of these traits? Example: IndexSequenceLikeor QueryLikeetc.

+4
source share
1 answer

The Like suffix is ​​used for implementation features, similar to how Java uses "Impl" to implement the interface.

http://docs.scala-lang.org/overviews/core/architecture-of-scala-collections.html

Scala traits are similar to Java interfaces, only better because traits can contain function definitions, not just declarations.

, IndexedSeqLike IndexedSeq (). .

Scala, , Iterator .

+4

Source: https://habr.com/ru/post/1544223/


All Articles