This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-12
Channels
- # aleph (22)
- # aws (7)
- # babashka (17)
- # beginners (69)
- # chlorine-clover (9)
- # cider (2)
- # clj-kondo (3)
- # cljdoc (30)
- # clojure (113)
- # clojure-dev (30)
- # clojure-europe (11)
- # clojure-italy (2)
- # clojure-nl (16)
- # clojure-spec (1)
- # clojure-sweden (3)
- # clojure-uk (17)
- # clojurescript (77)
- # cryogen (12)
- # data-science (5)
- # datomic (27)
- # duct (2)
- # emacs (37)
- # fulcro (24)
- # graphql (2)
- # kaocha (1)
- # lambdaisland (27)
- # leiningen (4)
- # off-topic (15)
- # onyx (1)
- # other-lisps (3)
- # re-frame (94)
- # reagent (2)
- # reitit (20)
- # ring (1)
- # shadow-cljs (66)
- # spacemacs (5)
- # sql (59)
- # tools-deps (140)
- # vim (1)
- # xtdb (17)
@jjttjj true, sci can be used for "safe" code execution. by default it allows no interop, not even println
for extra control you can use :deny
to deny certain functions, like swap!
, just to name some silly example
there is also :allow
which only explicitly allows certain functions. also :realize-max
to prevent evaluating infinite lazy seqs
@jjttjj you mean having sci on the server and client, right? I first read public cljs sci client, but I hope that's not what you meant
@jeroenvandijk basically sending quoted sci forms from a cljs front end to a clj server to be eval'd and the results sent back to the front end. Basically I want to use it as a sort of query langauge, where I send the quoted sci code to the server, which has :bindings
for a few db access functions
cool 🙂
Is there a way to add data readers to sci? Basically looking to get this to work:
(sci/eval-string
"(println #time/zoned-date-time \"2020-02-12T11:51:28.428005-05:00[America/New_York]\")"
{:bindings {'println println}
:classes {'java.time.ZonedDateTime
java.time.ZonedDateTime}})
;;[line 1, col 84] No reader function for tag time/zoned-date-time.
Do I basically need a macro like this: https://github.com/borkdude/babashka/blob/ab6ea2de081384b202ce0d804630d64429975e23/src/babashka/impl/clojure/main.clj#L26
@jjttjj Sci uses edamame for code parsing. Edamame does support a :readers
option:
https://github.com/borkdude/edamame
But I don't think this option is currently supported in the sci options map. We could just add it very easily.
I'm currently on my way to a meetup to do a talk on babashka and sci, so I have very little time today, but maybe you can figure it out and make a PR?