Вопрос

I am trying to fiddle a bit with ClojureScript, but it is more cumbersome than I would like.

I am able to get browser-connected REPL and interact with a live page. The problem is that I am not able to recover from exceptions. I often make typing mistakes which result in exceptions. Moreover, while I find my way around ClojureScript, I am collecting a little library of useful function. It happens that these functions contain mistakes, and when I load these modules I get other exceptions.

The only thing I am able to do in this situation is stop everything with Ctrl-C. Which is painful, since before I can get anything done, I have to start the REPL again, which involves starting the JVM, something that is not exactly quick.

Is there a way to recover from exceptions in the REPL without losing all the context so far?

Это было полезно?

Решение

I've experienced similar difficulties. I had particular problems playing with clojurescript one and using xpath expressions to locate DOM elements. A syntactic error in the xpath (missing " or missing close ]) was a showstopper. I don't have a full solution, but I have found that sometimes executing a correct form does sort things out.

I try a

(js/alert "hello world!")

even if it looks like the REPL is hung and this often works.

Failing that refresh the browser page to re-establish the connection between the browser and the execution environment.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top