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

Re: Extending Scala interpreter and accessing its state and functions

1 reply
Tom Murray
Joined: 2011-10-13,
User offline. Last seen 42 years 45 weeks ago.
Bounced because I wasn't yet a member.

On Thu, Oct 13, 2011 at 1:28 PM, Tom Murray <yozhipozhi [at] gmail [dot] com> wrote:
I thought I might see you here, Big Nerd!
To give a bit more context: I'm trying to promote the Scala repl as an interactive data exploration tool (using FlumeJava and a Scala version you might be familiar with). Initially, I'm targeting people who are fairly technical but not engineers, so I want this to be as easy and magical as possible.
tm

p.s. Unless I'm missing something, I think it's ok to treat build system as completely external, i.e. I don't see need for integration? I build my repl using it, and haven't had any trouble loading jars I build with :cp.

On Thu, Oct 13, 2011 at 12:24 PM, Josh Suereth <joshua [dot] suereth [at] gmail [dot] com> wrote:
Twin of Moravia-
I'm moving your message to scala-internals where I think you might find more folks who can help you (specifically Paul Phillips).
I have a guess at which build system you're suggesting you want to integrate with.  If things haven't changed in a few months, you may need to alter the integration of Scala + {work's build system}.  If you can convince someone to give you a classpath where re-building the JAR files end up in the same locations, you can :replay to re-run your session with the same classpath, but the new class files.
I once knew of someone who had an OKR to do that, but I have no idea of the status anymore.
- Big Nerd

---------- Forwarded message ----------
From: Tom Murray <yozhipozhi [at] gmail [dot] com>
Date: Thu, Oct 13, 2011 at 2:52 PM
Subject: [scala-user] Extending Scala interpreter and accessing its state and functions
To: scala-user [at] googlegroups [dot] com


Hi--
I'm interested in adding a new command to a Scala interpreter, and was wondering how best to go about it. For bonus points, I'd like to be able to call another built-in interpreter command from my new command.
Details: I'd like to add something like a ":rejar BUILD-TARGET" command which would build a jar using the build system at work and then call ":cp JAR" on the newly built jar file. In other words, I'd like to get something close to the convenience of :load for Java code (I understand from the code comments that this is a little dangerous, but...).
I've poked around within the interpreter and in the scala.tools.nsc package, but it wasn't clear to me how I should approach this.
Thanks for your help,
tm


Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Extending Scala interpreter and accessing its state and fun
Have you seen the cascade2 stuff? I wired into scala 2.8 Flume support in a scala library.  It will capture REPL-defined classes and feed them along with the MSCR definitions when running your map-reductions.   If you internal google for it, you should see the tech talk I gave with the details.  I mentioned to my old office mate, that tieing in Scalalab would have made for an awesome data analysis environemnt.
You should still be able to find my REPL-data-exploration scripties in //experimental/joshuasuereth/gtutils/live  (at least I think they were in live).
- Josh

On Thu, Oct 13, 2011 at 4:28 PM, Tom Murray <yozhipozhi [at] gmail [dot] com> wrote:
I thought I might see you here, Big Nerd!
To give a bit more context: I'm trying to promote the Scala repl as an interactive data exploration tool (using FlumeJava and a Scala version you might be familiar with). Initially, I'm targeting people who are fairly technical but not engineers, so I want this to be as easy and magical as possible.
tm

p.s. Unless I'm missing something, I think it's ok to treat build system as completely external, i.e. I don't see need for integration? I build my repl using it, and haven't had any trouble loading jars I build with :cp.

On Thu, Oct 13, 2011 at 12:24 PM, Josh Suereth <joshua [dot] suereth [at] gmail [dot] com> wrote:
Twin of Moravia-
I'm moving your message to scala-internals where I think you might find more folks who can help you (specifically Paul Phillips).
I have a guess at which build system you're suggesting you want to integrate with.  If things haven't changed in a few months, you may need to alter the integration of Scala + {work's build system}.  If you can convince someone to give you a classpath where re-building the JAR files end up in the same locations, you can :replay to re-run your session with the same classpath, but the new class files.
I once knew of someone who had an OKR to do that, but I have no idea of the status anymore.
- Big Nerd

---------- Forwarded message ----------
From: Tom Murray <yozhipozhi [at] gmail [dot] com>
Date: Thu, Oct 13, 2011 at 2:52 PM
Subject: [scala-user] Extending Scala interpreter and accessing its state and functions
To: scala-user [at] googlegroups [dot] com


Hi--
I'm interested in adding a new command to a Scala interpreter, and was wondering how best to go about it. For bonus points, I'd like to be able to call another built-in interpreter command from my new command.
Details: I'd like to add something like a ":rejar BUILD-TARGET" command which would build a jar using the build system at work and then call ":cp JAR" on the newly built jar file. In other words, I'd like to get something close to the convenience of :load for Java code (I understand from the code comments that this is a little dangerous, but...).
I've poked around within the interpreter and in the scala.tools.nsc package, but it wasn't clear to me how I should approach this.
Thanks for your help,
tm


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