Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Evaluating Scala with twitter Eval and Scala notebook

Tags:

scala

twitter

I've been using twitter Eval function to compile Scala functions. But would prefer to evaluate the function as being provided at project scala-notebook (https://github.com/Bridgewater/scala-notebook)

Is scala-notebook hooking up to the internal repl of machine its running on ?

How is it different to twitter Eval library (https://twitter.github.io/util/docs/index.html#com.twitter.util.Eval) ?

like image 628
blue-sky Avatar asked Dec 30 '15 13:12

blue-sky


1 Answers

Both scala-notebook and twitter-eval use the scala-compiler tool under the hood to compile and interpret the text as scala code. So, technically there is no difference between those two with regard to how they compile the source code.

Just to shed some light on how they both do that, check out the below files:

scala-notebook: https://github.com/Bridgewater/scala-notebook/blob/master/kernel/src/main/scala/com/bwater/notebook/kernel/Repl.scala

twitter-eval: https://github.com/twitter/util/blob/develop/util-eval/src/main/scala/com/twitter/util/Eval.scala

As you can see, both of the use the scala-compiler. The compiler classes and utilities are located in the package 'scala.tools'

like image 168
James Avatar answered Oct 02 '22 13:10

James