1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-07 02:53:02 +00:00

Simplify eval.

Also add more conventional handling of nil to the `compile` function.
This commit is contained in:
Calvin Rose
2022-11-11 11:25:06 -06:00
parent 8d1cfe0c56
commit 6a557a73f5
2 changed files with 7 additions and 5 deletions

View File

@@ -2534,7 +2534,7 @@
(in env :exit-value env))
(defn quit
``Tries to exit from the current repl or context. Does not always exit the application.
``Tries to exit from the current repl or run-context. Does not always exit the application.
Works by setting the :exit dynamic binding to true. Passing a non-nil `value` here will cause the outer
run-context to return that value.``
[&opt value]
@@ -2546,7 +2546,7 @@
``Evaluates a form in the current environment. If more control over the
environment is needed, use `run-context`.``
[form]
(def res (compile form (fiber/getenv (fiber/current)) :eval))
(def res (compile form nil :eval))
(if (= (type res) :function)
(res)
(error (get res :error))))