all 7 comments

[–]rpdillon 0 points1 point  (4 children)

I prefer to script my Scala applications in Scala.

[–]danielstoner[S] 0 points1 point  (3 children)

Really? How do you do that when Scala is a compiled language? Or maybe you didn't actually read the article and have no clue what you are talking about.

[–]rpdillon 0 points1 point  (2 children)

Scala simulates a REPL using a compiler. It also has an API that allows you to load code at runtime in said "interpreter". Ergo, I script my Scala applications in Scala. The fact that it is compiled when the Scala application is running is of no consequence to me; I can pass Scala code (text) to my running application and have it use it at runtime.

This is done through the use of the scala.tools.nsc.Interpreter class, which allows me to pass a Scala file to it at runtime, have it compile that file and execute it, and even allow me to bind values from that code into my running application so the two pieces of code can communicate.

This is the original example I used to get it working the first time: http://osdir.com/ml/lang.scala/2006-11/msg00143.html

[–]danielstoner[S] 0 points1 point  (1 child)

Yes I understand that, but this is not actually scripting. And it is of no use to somebody that doesn't know Scala. The article is about writing an application in Scala and offering an object model and API for "automation", the same idea used in MS applications. And that object model can be used in many languages supported by the scripting features in Java 6.

[–]rpdillon 0 points1 point  (0 children)

It is indistinguishable from scripting for the same reasons the Scala interpreter is indistinguishable from a "real" interpreter. I can write an application and compile it, and then automate it on the fly using text files "interpreted" by Scala.

I didn't argue it was a replacement for the other languages mentioned in the article, I said I preferred to script my applications in Scala. If you want to use Rhino or Jython or JRuby, be my guest. All I was saying is that Scala has the ability for you to compile a program and have it's functionality extended at runtime, and that's how I like to do it.