This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Case classes and the scala interpreter

No replies
john kemp
Joined: 2009-01-06,
User offline. Last seen 42 years 45 weeks ago.

Hello,

I have a file called HttpServer.scala, which contains the following
code snippets:

--------------------------

package httpd

...

case class Incoming(socket: Socket, document_root:String)

--------------------------

I set my $classpath appropriately, and then import this file into a
Scala script which does the following:

...
import httpd.Incoming
...

And when I run:

'scala test.scala', I am told:

(fragment of test.scala):8: error: Incoming is not a member of httpd
import httpd.Incoming

If I compile everything statically using scalac, it all works.

Now, if I change that line of the source to:

import httpd._

Everything works as expected with the interpreter too.

I confess to being a Scala newbie, but this behaviour with case
classes is a bit unexpected. Am I doing something wrong?

- johnk

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland