sci

borkdude 2022-05-15T10:38:33.802839Z

@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
borkdude 2022-05-15T10:40:06.635719Z

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

borkdude 2022-05-15T12:18:33.145739Z

Merged to master now

devn 2022-05-15T19:37:28.547839Z

beautiful. thanks!

devn 2022-05-15T19:38:18.176469Z

@borkdude haven’t reviewed the commit yet, but is print-dup going to get the same treatment?

devn 2022-05-15T19:40:43.788549Z

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

borkdude 2022-05-15T19:44:30.422659Z

@devn Now did the same for print-dup

borkdude 2022-05-15T19:48:05.250459Z

Thanks for uncovering these things with http://getclojure.org :)

devn 2022-05-15T19:49:53.930179Z

my pleasure! btw, took your observation and removed things returning #object, though not everywhere as there are cases of (#object[…] #object[...] :foo)

devn 2022-05-15T19:50:03.901899Z

need to update the index in prod

borkdude 2022-05-15T19:50:26.820519Z

also things returning functions, or does that fall into that category?

devn 2022-05-15T19:51:05.849299Z

same category yeah, hence all of my confusion relating to the pretty printing in cider nrepl

devn 2022-05-15T19:52:03.505639Z

i was trying to remove things starting with "#function" and getting strange results

devn 2022-05-15T21:36:15.917879Z

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

borkdude 2022-05-15T21:37:40.707919Z

$ bb -e '(-> 1 inc inc inc inc inc)'
6
Seems normal in SCI

devn 2022-05-15T21:38:11.300459Z

yeah, very confused on this one: https://getclojure.org/search?q=inc&num=0

borkdude 2022-05-15T21:39:40.792919Z

are you doing a manual macroexpand or so?

devn 2022-05-15T21:46:09.507069Z

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

devn 2022-05-15T21:46:29.589089Z

borkdude 2022-05-15T21:58:57.984569Z

Perhaps some re-definition of -> which should not be possible by default

devn 2022-05-15T21:59:10.727379Z

yeah i’ve been scouring looking for something like that

devn 2022-05-15T22:18:37.128409Z

boom, found it

devn 2022-05-15T22:18:41.913579Z

(alter-meta! #'-> dissoc :macro)

devn 2022-05-15T22:20:46.334319Z

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

devn 2022-05-16T01:02:40.461259Z

I’ve created an issue here: https://github.com/babashka/sci/issues/733

devn 2022-05-16T01:05:12.100949Z

I am thinking of automating finding situations like this by running every single expression in the sandbox after every single other expression in SCI.

borkdude 2022-05-16T05:58:52.441409Z

Thanks, good catch!

borkdude 2022-05-16T07:09:22.109439Z

Fixed

ā¤ļø 1