ClojureScript

Rhino & Nashorn Socket REPLs don't share evaluation environment

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Clojure Socket REPLs share an evaluation environment.

For example, start up with

java -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}" -cp cljs.jar clojure.main

Then in one terminal

$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> (def x 3)
#'user/x

then if you go into another terminal

$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> x
3

and in the original terminal where you started the socket REPL:

user=> x
3

Here is what I get with the Node Socket REPL (not sure if I'm starting it the right way):

java -Dclojure.server.repl="{:port 5555 :accept cljs.server.node/repl}" -cp cljs.jar clojure.main

First terminal:

$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> (def x 3)
#'cljs.user/x

Second terminal:

$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> x
WARNING: Use of undeclared Var cljs.user/x at line 1 <cljs repl>
nil

Activity

Mike Fikes made changes -
Field Original Value New Value
Description Clojure Socket REPLs share an evaluation environment.

For example, start up with

{noformat}
java -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}" -cp cljs.jar clojure.main
{noformat}

Then in one terminal

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> (def x 3)
#'user/x
{noformat}

then if you go into another terminal

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> x
3
{noformat}


Here is what I get with the Node Socket REPL (not sure if I'm starting it the right way):

{noformat}
java -Dclojure.server.repl="{:port 5555 :accept cljs.server.node/repl}" -cp cljs.jar clojure.main
{noformat}

First terminal:

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> (def x 3)
#'cljs.user/x
{noformat}


Second terminal:

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> x
WARNING: Use of undeclared Var cljs.user/x at line 1 <cljs repl>
nil
{noformat}
Clojure Socket REPLs share an evaluation environment.

For example, start up with

{noformat}
java -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}" -cp cljs.jar clojure.main
{noformat}

Then in one terminal

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> (def x 3)
#'user/x
{noformat}

then if you go into another terminal

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
user=> x
3
{noformat}

and in the original terminal where you started the socket REPL:

{noformat}
user=> x
3
{noformat}


Here is what I get with the Node Socket REPL (not sure if I'm starting it the right way):

{noformat}
java -Dclojure.server.repl="{:port 5555 :accept cljs.server.node/repl}" -cp cljs.jar clojure.main
{noformat}

First terminal:

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> (def x 3)
#'cljs.user/x
{noformat}


Second terminal:

{noformat}
$ telnet 0 5555
Trying 0.0.0.0...
Connected to localhost.
Escape character is '^]'.
ClojureScript 1.10.160
cljs.user=> x
WARNING: Use of undeclared Var cljs.user/x at line 1 <cljs repl>
nil
{noformat}
Hide
David Nolen added a comment - - edited

To clarify, ClojureScript Socket REPLs must be made to work this way one by one. Only cljs.server.browser currently works this way. The others needs to be adjusted. The main thrust of this work is to make -setup & -teardown idempotent and thread safe. The other bit is to make sure that output gets directed correctly. Browser REPL currently exhibits this bug https://dev.clojure.org/jira/browse/CLJS-2643.

Show
David Nolen added a comment - - edited To clarify, ClojureScript Socket REPLs must be made to work this way one by one. Only cljs.server.browser currently works this way. The others needs to be adjusted. The main thrust of this work is to make -setup & -teardown idempotent and thread safe. The other bit is to make sure that output gets directed correctly. Browser REPL currently exhibits this bug https://dev.clojure.org/jira/browse/CLJS-2643.
David Nolen made changes -
Summary Socket REPL doesn't share evaluation environment Rhino & Nashorn Socket REPLs don't share evaluation environment

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: