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

JSR 223 Implement get, getBindings, and setBindings #7916

Closed
scabug opened this issue Oct 16, 2013 · 21 comments
Closed

JSR 223 Implement get, getBindings, and setBindings #7916

scabug opened this issue Oct 16, 2013 · 21 comments

Comments

@scabug
Copy link

scabug commented Oct 16, 2013

(No description for SI-7916.)

@scabug
Copy link
Author

scabug commented Oct 16, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7916?orig=1
Reporter: @jedesah
Affected Versions: 2.11.0-M8
See #8422

@scabug
Copy link
Author

scabug commented Feb 10, 2014

@adriaanm said:
Since 2.11.0-RC1 is one week away, pushing all non-blockers without PR to 2.11.1-RC1. Please undo the change if I missed work in progress.

@scabug
Copy link
Author

scabug commented Aug 5, 2014

@gkossakowski said:
The 2.11.2 is out so I'm rescheduling the issue for 2.11.3.

@scabug
Copy link
Author

scabug commented Nov 4, 2014

@retronym said:
Updating fix-by version to 2.11.5.

@scabug
Copy link
Author

scabug commented Mar 14, 2015

Margaret Leber (MaggieL) said:
@moors So...I'm not familiar with the project workflow but this is still a problem in 2.11.6

@scabug
Copy link
Author

scabug commented Sep 8, 2015

@SethTisue said:
re: the status of Scala's JSR 223 support, see #8422

@scabug
Copy link
Author

scabug commented Sep 9, 2015

@SethTisue said:
I imagine it would be possible to work around this by casting the ScriptEngine returned to IMain:

val engine = new ScriptEngineManager().getEngineByName("scala")
val iMain = engine.asInstanceOf[scala.tools.nsc.interpreter.IMain]

and then just interact with it directly with there, bypassing the official JSR 223 API. (I don't know IMain well enough to give details offhand, though.)

@scabug
Copy link
Author

scabug commented Sep 9, 2015

Margaret Leber (MaggieL) said:
It's good to have a workaround for cases where one controls the source of the calls to ScriptEngineManager.
But let's not forget the whole reason for JSR-223 is to address pluggable scripting components without doing that kind of thing.

@scabug
Copy link
Author

scabug commented Sep 9, 2015

@SethTisue said:
Note that put works (as in the example in http://docs.scala-lang.org/scala/2.11/, which works in both 2.11.0 and 2.11.7), and that although get doesn't work, an easy workaround is to use eval instead. Of course, it would be better if get were supported, so I've edited the ticket name to include it.

@scabug
Copy link
Author

scabug commented Sep 9, 2015

@som-snytt said:
At some point, I pulled the ScriptEngine support out of IMain into a separate adapter. I'll try to supply a PR, but that would probably be for 2.12. It's not brain surgery, but more like pulling out quills after encountering a porcupine.

When they say, "Scala supports...," they mean, "The Scala team fully supports anyone who'd like to contribute it."

@scabug
Copy link
Author

scabug commented Feb 2, 2016

@som-snytt said:
scala/scala#4819

@scabug
Copy link
Author

scabug commented Feb 16, 2016

@lrytz said:
[~MaggieL] would you be interested in reviewing the PR scala/scala#4819? If you don't want to get the revision from github and build it from source, I packed a build and put it here: https://dl.dropboxusercontent.com/u/4881107/scala-8876c1d.zip.

@scabug
Copy link
Author

scabug commented Feb 16, 2016

Margaret Leber (MaggieL) said:
@lukas Rytz I can't promise to do it immediately; unfortunately my time is not my own. But I will do my best to try to test it for my (quite convoluted) use case as soon as possible.

Thanks for working on this, guys,

@scabug
Copy link
Author

scabug commented Feb 20, 2016

Margaret Leber (MaggieL) said:
Fiddling with this now. Dusting off a year-old branch of our app that I'm glad I kept around now. Many hacks need to be re-done...

@scabug
Copy link
Author

scabug commented Feb 21, 2016

Margaret Leber (MaggieL) said:
Well, it was a tough fight, but I finally got somewhere! Not my actual use case but a vastly simplified proof-of-concept.

Details here:
scala/scala#4819 (comment)

@scabug
Copy link
Author

scabug commented Feb 22, 2016

Margaret Leber (MaggieL) said (edited on Feb 22, 2016 1:55:30 PM UTC):
Unfortunately, I think any approach that erases type information in the objects in a ScriptContext is in for a very rough ride from folks approaching Scala as a JSR223 implemention. It's common for a JSR223 host to chain script executions, sharing their contexts between executions which may occur under different ScriptEngines. Activiti and jMeter are good examples. That said, I suppose it's better than not working at all.

@scabug
Copy link
Author

scabug commented Mar 11, 2016

Margaret Leber (MaggieL) said:
Just thought I'd mention here that discussion on the PR has schooled me on why this has to work the way it does, really hoping we can see this merged and available in 2.12

scala/scala#4819 (comment)

@scabug
Copy link
Author

scabug commented Mar 11, 2016

@SethTisue said (edited on Mar 11, 2016 10:37:39 PM UTC):
thanks Maggie! it seems nearly certain the PR will be merged once @som-snytt finds time to do a little more work on it.

@scabug
Copy link
Author

scabug commented Mar 11, 2016

@som-snytt said:
Wait, there's work?!

@scabug
Copy link
Author

scabug commented Mar 11, 2016

@SethTisue said:
isn't there?

@scabug
Copy link
Author

scabug commented May 31, 2016

@som-snytt said:
I guess there was. Still scala/scala#4819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants