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

What happens when you start a CLJS REPL? #1

Open
thheller opened this issue Mar 2, 2017 · 7 comments
Open

What happens when you start a CLJS REPL? #1

thheller opened this issue Mar 2, 2017 · 7 comments
Labels

Comments

@thheller
Copy link

thheller commented Mar 2, 2017

Hey, just saw this in my Twitter feed.

I recently spent some time with REPL related ideas myself and one of the key requirements for me is that I want to be able to launch a CLJS REPL seamlessly. I like your approach but what happens if you start another REPL that is not aware of this protocol?

Take the default CLJS REPL as an example. It will takeover the *in* and only write to *out*. While that should produce proper [:out ...] EDN forms (assuming you provide a custom *out* binding) that will be the only thing it sends. No :eval or :prompt. The UI I imagine you'd build out of this would seem "stuck"?

@cgrand
Copy link
Member

cgrand commented Mar 2, 2017

You nested them in the wrong order: (CLJ -> )CLJS -> EDN

@cgrand
Copy link
Member

cgrand commented Mar 2, 2017

However the real question to address is how to ensure that CLJ -> EDN -> CLJS -> EDN works.

@cgrand
Copy link
Member

cgrand commented Mar 3, 2017

Right now I'm thinking of having the server sending [:upgrade nil] before yielding control to the inner repl. Then the client can attempt upgrading plain cljs repl to an unrepl cljs repl.

@thheller
Copy link
Author

thheller commented Mar 3, 2017

The CLJS REPL has some other hidden "problems" in that print and eval happen in the JS runtime. This makes a custom eval and print tricky without having the code already present in CLJS.

Maybe the REPL should support arbitrary output streams (not just :out) as well. Since in the CLJS world you'll have the CLJS compiler producing output (eg. compile warnings) as well as the connected JS process.

@thheller
Copy link
Author

thheller commented Mar 3, 2017

As far as the output streams go, it would probably be useful to make them thread aware to avoid garbled output like

user=> (dotimes [x 10] (future (Thread/sleep 1) (prn :foooo)))
nil
user=> :foooo
:foooo
:foooo
:foooo:foooo

:foooo:foooo
:foooo:foooo


:foooo

So the tool can re-assemble the streams easily.

@cgrand
Copy link
Member

cgrand commented Mar 3, 2017

That's what the third optional component ("group id") is for in the tuples.

@cgrand
Copy link
Member

cgrand commented Mar 4, 2017

@thheller 1da6ef7 enables the use of "group id" in the prototype impl.

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

No branches or pull requests

2 participants