The Eval Function evaluates files, strings, or input streams as Scala code, and returns the result.
The eval function takes a single parameter Target. If the target is None, the results are compiled to memory (and are therefore ephemeral). If target is Some(path), the path must point to a directory, and classes will be saved into that directory.
The flow of evaluation is:
extract a string of code from the file, string, or input stream
run preprocessors on that string
wrap processed code in an apply method in a generated class
compile the class
contruct an instance of that class
return the result of apply()
Declare an Interface which your Dynamic Code should Follow
For the Example I’ve declared a variable name and a function orderString in my trait.
The Dynamic Code which would be evaluated at runtime
Saving the file in the location /path/tsv.scala
Saving the file in the location /path/csv.scala
Now we can Load these files at runtime to execute the functions