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

-savecompiled ?

3 replies
Michael Fortin 2
Joined: 2010-08-29,
User offline. Last seen 42 years 45 weeks ago.

Am I doing something wrong here? Shouldn't I expect to see a MyScript.class in the same directory as MyScript.scala? Is it being saved to some other directory?

[m410@m410 temp]% vi MyScript.scala
[m410@m410 temp]% scala-2.8 -savecompiled
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :load MyScript.scala
Loading MyScript.scala...
defined class MyScript

scala> MyScript("hello")
res0: MyScript = MyScript(hello)

scala> :q
[m410@m410 temp]% ls -lh
total 40
-rw-r--r-- 1 m410 staff 32B Sep 27 22:39 MyScript.scala
drwxr-xr-x 3 m410 staff 102B Sep 27 22:38 out
drwxr-xr-x 5 m410 staff 170B Sep 27 15:42 ...

out is empty as well and I tried loading the script with '-i MyScript.scala' with the same none result.

thx
Mike

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: -savecompiled ?
I think it saves to the TMP, TMPDIR or equivalent, by default.

On Mon, Sep 27, 2010 at 23:47, Michael Fortin <mikee [at] m410 [dot] us> wrote:
Am I doing something wrong here? Shouldn't I expect to see a MyScript.class in the same directory as MyScript.scala?  Is it being saved to some other directory?

[m410@m410 temp]% vi MyScript.scala
[m410@m410 temp]% scala-2.8 -savecompiled
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :load MyScript.scala
Loading MyScript.scala...
defined class MyScript

scala> MyScript("hello")
res0: MyScript = MyScript(hello)

scala> :q
[m410@m410 temp]% ls -lh
total 40
-rw-r--r--   1 m410  staff    32B Sep 27 22:39 MyScript.scala
drwxr-xr-x   3 m410  staff   102B Sep 27 22:38 out
drwxr-xr-x   5 m410  staff   170B Sep 27 15:42 ...

out is empty as well and I tried loading the script with '-i MyScript.scala' with the same none result.

thx
Mike






--
Daniel C. Sobral

I travel to the future all the time.
Michael Fortin 2
Joined: 2010-08-29,
User offline. Last seen 42 years 45 weeks ago.
Re: -savecompiled ?
Nope, nothing there, but thanks for the suggestion.  Any other ideas?
Mike
On Sep 27, 2010, at 10:50 PM, Daniel Sobral wrote:
I think it saves to the TMP, TMPDIR or equivalent, by default.

On Mon, Sep 27, 2010 at 23:47, Michael Fortin <mikee [at] m410 [dot] us> wrote:
Am I doing something wrong here? Shouldn't I expect to see a MyScript.class in the same directory as MyScript.scala?  Is it being saved to some other directory?

[m410@m410 temp]% vi MyScript.scala
[m410@m410 temp]% scala-2.8 -savecompiled
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :load MyScript.scala
Loading MyScript.scala...
defined class MyScript

scala> MyScript("hello")
res0: MyScript = MyScript(hello)

scala> :q
[m410@m410 temp]% ls -lh
total 40
-rw-r--r--   1 m410  staff    32B Sep 27 22:39 MyScript.scala
drwxr-xr-x   3 m410  staff   102B Sep 27 22:38 out
drwxr-xr-x   5 m410  staff   170B Sep 27 15:42 ...

out is empty as well and I tried loading the script with '-i MyScript.scala' with the same none result.

thx
Mike






--
Daniel C. Sobral

I travel to the future all the time.

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: -savecompiled ?

On Mon, Sep 27, 2010 at 11:24:21PM -0400, Michael Fortin wrote:
> Nope, nothing there, but thanks for the suggestion. Any other ideas?

I imagine it's dutifully saving the script into the repl backing store,
which is to say, RAM. Either that or ignoring you.

-savecompiled wasn't written to be used with the repl. It was written
to be used with scripts.

% cat > hi.scala
println("hi")
% scala28 -savecompiled hi.scala
hi
% ls -l hi*
-rw-r--r-- 1 paulp wheel 14 Sep 27 20:40 hi.scala
-rw-r--r-- 1 paulp wheel 1580 Sep 27 20:41 hi.scala.jar
% jar tf hi.scala.jar
Main$$anon$1.class
Main$.class
Main.class

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