Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SI-7933 REPL javax.script eval is cached result #3433

Merged
merged 1 commit into from Feb 10, 2014

Conversation

rjolly
Copy link
Contributor

@rjolly rjolly commented Jan 30, 2014

No description provided.

def eval(reader: java.io.Reader, context: ScriptContext): Object = compile(reader).eval(context)
def eval(reader: java.io.Reader, context: ScriptContext): Object = eval(reader: String, context)

implicit def reader2string(reader: java.io.Reader) = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could move this next to scala.tools.nsc.util.stringFromWriter?

@adriaanm
Copy link
Contributor

please update the commit message with a short description of what the problem was and how it's solved

@ghost ghost assigned adriaanm Jan 30, 2014
The problem is that the repl underneath the script engine evaluates input to
val res0..resN, so it is a one shot operation. To allow repetition,
compile(script) now returns a CompiledScript object whose eval method can be
called any number of times.
@adriaanm
Copy link
Contributor

adriaanm commented Feb 5, 2014

Thanks for clarifying, but I still have some questions.
Is this something that affects the repl under normal operation?

If so, I'm not sure we want to take that hit. Is there a way to only do this wrapping in CompiledScript when running in ScriptEngine mode?

@rjolly
Copy link
Contributor Author

rjolly commented Feb 6, 2014

Adriaan,
It is already the case. The repl is not impacted at all by the change.

@adriaanm
Copy link
Contributor

Ok, sorry, I'm a bit new to the repl code base.

adriaanm added a commit that referenced this pull request Feb 10, 2014
SI-7933 REPL javax.script eval is cached result
@adriaanm adriaanm merged commit 71c596a into scala:master Feb 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants