Does Scala 2.10 have Foo by intention?

40 views
Skip to first unread message

Heiko Seeberger

unread,
Jul 18, 2012, 4:36:47 AM7/18/12
to scala-i...@googlegroups.com
tmp$ scala-2.10
Welcome to Scala version 2.10.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
Type in expressions to have them evaluated.
Type :help for more information.

scala> Foo.foo
res0: Int = 0

scala> :javap -p Foo
Compiled from "test.scala"
public final class Foo extends java.lang.Object{
public static void main(java.lang.String[]);
public static void delayedInit(scala.Function0);
public static java.lang.String[] args();
public static void scala$App$_setter_$executionStart_$eq(long);
public static long executionStart();
public static void foo_$eq(int);
public static int foo();
}

Cheers
Heiko

--

Heiko Seeberger
Twitter: @hseeberger
Blog: heikoseeberger.name
Company: Typesafe - The software stack for applications that scale
Author of Durchstarten mit Scala, a German tutorial-style Scala book

Grzegorz Kossakowski

unread,
Jul 18, 2012, 4:43:02 AM7/18/12
to scala-i...@googlegroups.com
On 18 July 2012 10:36, Heiko Seeberger <heiko.s...@gmail.com> wrote:
tmp$ scala-2.10
Welcome to Scala version 2.10.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
Type in expressions to have them evaluated.
Type :help for more information.

scala> Foo.foo
res0: Int = 0

scala> :javap -p Foo
Compiled from "test.scala"
public final class Foo extends java.lang.Object{
    public static void main(java.lang.String[]);
    public static void delayedInit(scala.Function0);
    public static java.lang.String[] args();
    public static void scala$App$_setter_$executionStart_$eq(long);
    public static long executionStart();
    public static void foo_$eq(int);
    public static int foo();
}

Cannot reproduce:

---
./bin/scala
Welcome to Scala version 2.10.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_33).
Type in expressions to have them evaluated.
Type :help for more information.

scala> Foo.foo
<console>:8: error: not found: value Foo
              Foo.foo
              ^
---

Probably your classpath is polluted.

--
Grzegorz Kossakowski

Heiko Seeberger

unread,
Jul 18, 2012, 4:52:09 AM7/18/12
to scala-i...@googlegroups.com
On Jul 18, 2012, at 10:43 AM, Grzegorz Kossakowski wrote:

> Probably your classpath is polluted.

I have no idea how this could happen, because I am simply running the scala command which comes with the 2.10.0-M5 distribution.

By the way, I cannot reproduce it when I start the REPL from an sbt project.

Heiko

Lukas Rytz

unread,
Jul 18, 2012, 4:54:39 AM7/18/12
to scala-i...@googlegroups.com
On Wed, Jul 18, 2012 at 10:52 AM, Heiko Seeberger <heiko.s...@gmail.com> wrote:
On Jul 18, 2012, at 10:43 AM, Grzegorz Kossakowski wrote:

> Probably your classpath is polluted.

I have no idea how this could happen, because I am simply running the scala command which comes with the 2.10.0-M5 distribution.

Is the current directory on the classpath by default? I cannot reproduce either.

Eugene Burmako

unread,
Jul 18, 2012, 4:55:37 AM7/18/12
to scala-i...@googlegroups.com
Probably you have the CLASSPATH environment variable pointing to something that contains Foo?

Mirko Stocker

unread,
Jul 18, 2012, 5:12:38 AM7/18/12
to scala-i...@googlegroups.com
On Wednesday 18 July 2012 10:52:09 Heiko Seeberger wrote:
> I have no idea how this could happen, because I am simply running the scala
> command which comes with the 2.10.0-M5 distribution.

The settings object shows the classpath, and it seems to contain the current
directory by default:

scala> :power

scala> settings
res0: scala.tools.nsc.Settings =
Settings {
-d = .
-encoding = UTF-8
}

Cheers,

Mirko

--
Mirko Stocker | m...@misto.ch
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st

Heiko Seeberger

unread,
Jul 18, 2012, 6:06:08 AM7/18/12
to scala-i...@googlegroups.com
On Jul 18, 2012, at 10:54 AM, Lukas Rytz wrote:

> Is the current directory on the classpath by default? I cannot reproduce either.

It is and my tmp directory from where I started the REPL contains Foo.class ;-)

Sorry for the noise!

Heiko


Reply all
Reply to author
Forward
0 new messages