Question on List class in 2.13

#1

I was looking at the source code for List class in 2.13 and could not find abstract declarations for isEmpty, head and tail. I do see them in 2.12.8. Can anyone explain how they are referred to in List class in the latest version?

Thanks

#2

From what I can tell, this is (kind of) explained in the Scaladoc for the scala.collection.immutable.List class

However, isEmpty appears to be implemented directly on the list, rather than in the individual case classes, so the Scaladoc is wrong in that regard.

You should be able to see head and tail on the case classes that implemented List, however. In the case of ‘::’, head is a parameter to the class which is just returned, and is wrapped by headOption. For Nil, it’s just returned as Nothing.

#3

Good point about isEmpty. However, everything is not clear yet. In 2.12, i see these declarations:

def isEmpty: Boolean
def head: A
def tail: List[A]
No such declarations in 2.13. Just the overrides. Where are they declared? I am no expert is scala so I may be missing something.

#4

I am also not an expert in Scala, but from what I can tell, head and tail declarations come into List via -> AbstractSeq -> AbstractIterable -> Iterable