Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

What it says on the tin.

Minimal repro here: https://github.com/eerohele/cljs-repl-blow-stack

I'm trying to make the simplest possible ClojureScript REPL. Am I doing something wrong, or is this a ClojureScript bug?

1 Answer

+1 vote
by
edited by

The error tells you that the exception is happening in the browser. Did you look there to see what the browser stack trace is?

As far as making the simplest possible REPL - the Quick Start has a better way - your minimal repro is doing a lot of steps that are no longer recommended and I cannot see what purpose Socket REPL is serving here other than making a more complicated stack trace.

Things you should not really do anymore:

  1. Build via a script and directly tapping the REPL APIs
  2. Use :browser target and manually try to connect (this is done for you)

Again please go through the Quick Start to see a simpler and standard way to do things.

At the very least it would give a real minimal reproducer and elide all these unnecessary steps.

UPDATE: I just tried with the QuickStart steps and I inputed an ns form at the REPL that matches the compiled source and I could not reproduce.

So there might be a bug here but you will definitely need to minimize this further.

by
edited by
Thanks for the answer!

>The error tells you that the exception is happening in the browser. Did you look there to see what the browser stack trace is?

Yes, I did -- there's nothing in the browser console.

Also, I've tried this a couple of more times after posting this question and I sometimes get an InternalError instead of a RangeError. Not really sure what to make of that, though.

>As far as making the simplest possible REPL - the Quick Start has a better way
> ...
>I cannot see what purpose Socket REPL is serving here

Apologies, I should've been more precise in my initial post. I'm trying to get a minimal REPL running in a socket so that I can connect to it from my editor. The repro I provided doesn't do this, but for my real use case, I also need to override the :print and :caught hooks of cljs.repl/repl so that evaluation results and exceptions are printed in a way my editor plugin expects to receive them. I also need to get a hold of the compiler environment for editor auto-completion etc.

Please correct me if I'm wrong, but I don't think the Quick Start approach offers a way to do those things. This might be sort of off-topic for this question, though -- I can post another one on that topic. After all, I'm now not quite sure how to implement ClojureScript editor integration if I can't or shouldn't use the REPL APIs.

In any case, it's good to know that this approach is not recommended.

>So there might be a bug here but you will definitely need to minimize this further

Gotcha. The issue certainly seems related to clojure.browser.repl, but I will need to investigate more to say for sure.
...