sci 2022-05-15

@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.

šŸ‘ 1

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 SCI

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

(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 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

ā¤ļø 1