mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
Make eval not the same as eval string.
This commit is contained in:
parent
89bd38890e
commit
97fade8197
@ -1238,7 +1238,7 @@ value, one key will be ignored."
|
||||
(when tail (file/write stderr " (tailcall)"))
|
||||
(file/write stderr "\n"))))
|
||||
|
||||
(defn eval
|
||||
(defn eval-string
|
||||
"Evaluates a string in the current environment. If more control over the
|
||||
environment is needed, use run-context."
|
||||
[str]
|
||||
@ -1258,6 +1258,15 @@ value, one key will be ignored."
|
||||
"eval")
|
||||
returnval)
|
||||
|
||||
(defn eval
|
||||
"Evaluates a form in the current environment. If more control over the
|
||||
environment is needed, use run-context."
|
||||
[form]
|
||||
(def res (compile form *env* "eval"))
|
||||
(if (= (type res) :function)
|
||||
(res)
|
||||
(error res:error)))
|
||||
|
||||
(do
|
||||
(def syspath (or (os/getenv "JANET_PATH") "/usr/local/lib/janet/"))
|
||||
(defglobal 'module/paths
|
||||
@ -1288,6 +1297,7 @@ value, one key will be ignored."
|
||||
(string/replace ".so" ".dll" x))))
|
||||
|
||||
(defn module/find
|
||||
"Try to match a module or path name from the patterns in paths."
|
||||
[path paths]
|
||||
(def parts (string/split "/" path))
|
||||
(def lastpart (get parts (- (length parts) 1)))
|
||||
|
Loading…
Reference in New Issue
Block a user