Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are the scala docs missing methods? [closed]

I have been trying to learn scala. One thing that I have noticed is the quality of the docs. They seem to miss out on a lot of methods. Is this intentional? I feel like I am missing something because they can't be this bad.

For example:

Blog post on reading files with scala. The blog post recommends using a scala.io.Source.fromFile(..) method to read a file. It provides an iterator. Looks very nice to use. I want to get a better understanding of the class, so I go to the scala docs on scala.io.Source.

No where in the docs does it show the method for scala.io.Source.fromFile(..). When I go to my IDE, it does try to autocomplete Source.fromFile(..), and it even works in the code.

This happened to me before when I was trying to use scala's database api. Am I missing something? Is there a secret button that pulls up this method? Have I gone my whole life being blind without realizing it? Or are the scaladocs really this bad?

like image 888
Leland Barton Avatar asked Oct 24 '14 05:10

Leland Barton


1 Answers

fromFile is not a method of class Source, it's a method of object Source. I.e. you can't write

val source: Source = ...
source.fromFile(...)

You are looking at the documentation for the class, which doesn't list the object's methods. The link to the object's documentation is the circle with C near the class name at the top.

like image 91
Alexey Romanov Avatar answered Oct 14 '22 18:10

Alexey Romanov