@devn I've got a fix underway for print-method - while fixing another issue I found a better way to do it. And by default print-method in SCI will throw when used with a direction on how to make it work when you don't need sandboxing.
I think that would be the cleanest option, it will make SCI safer by default, while breaking current users but the error should guide them to an easy fix
Merged to master now
beautiful. thanks!
@borkdude havenāt reviewed the commit yet, but is print-dup going to get the same treatment?
ah looks like this is just print-method, either way iām just adding print-method and print-dup to my :deny list for now
@devn Now did the same for print-dup
Thanks for uncovering these things with http://getclojure.org :)
my pleasure! btw, took your observation and removed things returning #object, though not everywhere as there are cases of (#object[ā¦] #object[...] :foo)
need to update the index in prod
also things returning functions, or does that fall into that category?
same category yeah, hence all of my confusion relating to the pretty printing in cider nrepl
i was trying to remove things starting with "#function" and getting strange results
i now have a new mystery that is frying my brain š I donāt think itās SCI-related, but:
"(-> 1 inc inc inc inc inc)" => "(#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] (#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] (#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] #object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"])))"
meanwhile (-> 3 inc inc inc) => 6
$ bb -e '(-> 1 inc inc inc inc inc)'
6
Seems normal in SCIyeah, very confused on this one: https://getclojure.org/search?q=inc&num=0
are you doing a manual macroexpand or so?
i donāt believe im engaging in any funny business like that, no. https://github.com/devn/getclojure/blob/main/src/getclojure/sexp.clj#L36 of course, I canāt reproduce in the REPL, only when running the full input set which takes about 20min. when i look at the raw strings that make it into elasticsearch, they look completely fine
Perhaps some re-definition of -> which should not be possible by default
yeah iāve been scouring looking for something like that
boom, found it
(alter-meta! #'-> dissoc :macro)
(sci/eval-string "(-> 1 inc inc)") ;; => 3
(sci/eval-string "(alter-meta! #'-> dissoc :macro)") ;; => nil
(sci/eval-string "(-> 1 inc inc)") ;; => #function[clojure.core/inc]Iāve created an issue here: https://github.com/babashka/sci/issues/733
I am thinking of automating finding situations like this by running every single expression in the sandbox after every single other expression in SCI.
Thanks, good catch!
Fixed