eval + read-string are moved to sci

This commit is contained in:
Michiel Borkent 2020-03-06 11:08:53 +01:00
parent 86bc422cd6
commit 0b23dd0fdb
2 changed files with 1 additions and 14 deletions

View file

@ -2,9 +2,7 @@
{:no-doc true}
(:refer-clojure :exclude [future read read-string])
(:require [borkdude.graal.locking :as locking]
[clojure.tools.reader.reader-types :as r]
[sci.impl.namespaces :refer [copy-core-var]]
[sci.impl.parser :as parser]))
[sci.impl.namespaces :refer [copy-core-var]]))
(defn locking* [form bindings v f & args]
(apply @#'locking/locking form bindings v f args))
@ -18,12 +16,6 @@
(prn (str "Elapsed time: " (/ (double (- (. System (nanoTime)) start#)) 1000000.0) " msecs"))
ret#))
(defn read-string
([sci-ctx s]
(let [reader (r/indexing-push-back-reader (r/push-back-reader s))]
(parser/parse-next sci-ctx reader)))
#_([opts s] (clojure.lang.RT/readString s opts)))
(def core-extras
{'file-seq (copy-core-var file-seq)
'agent agent
@ -35,7 +27,6 @@
'locking (with-meta locking* {:sci/macro true})
'shutdown-agents shutdown-agents
'slurp (copy-core-var slurp)
'read-string (with-meta read-string {:sci.impl/op :needs-ctx})
'spit (copy-core-var spit)
'time (with-meta time* {:sci/macro true})
'Throwable->map Throwable->map

View file

@ -210,9 +210,6 @@ Everything after that is bound to *command-line-args*."))
(sci/with-bindings {vars/current-file (.getCanonicalPath f)}
(eval-string* sci-ctx s))))
(defn eval* [sci-ctx form]
(eval-form sci-ctx form))
(defn start-socket-repl! [address ctx]
(socket-repl/start-repl! address ctx)
;; hang until SIGINT
@ -358,7 +355,6 @@ Everything after that is bound to *command-line-args*."))
_ (swap! (:env sci-ctx)
(fn [env]
(update-in env [:namespaces 'clojure.core] assoc
'eval #(eval* sci-ctx %)
'load-file #(load-file* sci-ctx %))))
_ (swap! (:env sci-ctx)
(fn [env]