Open brandonbloom opened 7 years ago
Perhaps Planck can monkey-patch this bit of code https://github.com/clojure/clojurescript/blob/47fa30dd95c850aa0643aae9c274c09bc202065c/src/main/cljs/cljs/core.cljs#L9297-L9302 or something could be revised in ClojureScript core to detect cycles in this case.
An interesting workaround:
(set! *print-level* 2)
cljs.user=> (set! *print-level* 2)
2
cljs.user=> js/window
#js {
...
:PLANCK_PRINT_FN #object[PLANCK_PRINT_FN "function PLANCK_PRINT_FN() {
[native code]
}"], :PLANCK_PRINT_ERR_FN #object[PLANCK_PRINT_ERR_FN "function PLANCK_PRINT_ERR_FN() {
[native code]
}"]}
cljs.user=>
If you use 3
for *print-level*
and interesting Cannot convert a symbol to a string
error is encountered.
With Planck 2.8.1, js/window
now produces a different "Cannot convert a symbol to a string" error when printed. So to repo, something like the following can now be done:
cljs.user=> (def x #js {:a 1})
#'cljs.user/x
cljs.user=> (goog.object/set x "me" x)
nil
cljs.user=> x
Maximum call stack size exceeded.
I realize that fipp doesn't help you here, but maybe the right thing to do for js objects is to use the underlying platform's inspection/printing?