views:

132

answers:

2

I've been told that Scaladocs is the best source for Scala API documentation: http://www.scala-lang.org/api/current/index.html

I've found an example using scala.io.Source.fromURL(url).getLines

The example works, but fromURL is not in that site. Where can I find a more exhaustive documentation on the methods available?

+2  A: 

Are you sure that fromURL isn't part of the object and not the trait or class? I found it in the object's API documents: here.

wheaties
That's it. I'm new to Scaladocs and I didn't know that objects and classes were both in the same menu entry under those little icons. Stackoverflow is awesome. Thanks!
Sebastián Grignoli
+12  A: 

If you see a green banner with a big "C", then you are looking at the class definition. Click the "companion" link to get to the companion object. This page will present a blue banner with a big "O". Your method is there.

In the side panel, the little 'c' and 'o' icons are separate links. You should choose the 'o' (object) when you are calling a static method (or method on the companion object, in Scala parlance).

Synesso
I've just started with Scala today. You already helped me twice. Thanks!
Sebastián Grignoli
No problem! You'll find plenty of helpful people answering the #scala questions on SO. Cheers!
Synesso