mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Make eval not the same as eval string.
This commit is contained in:
		| @@ -1238,7 +1238,7 @@ value, one key will be ignored." | |||||||
|       (when tail (file/write stderr " (tailcall)")) |       (when tail (file/write stderr " (tailcall)")) | ||||||
|       (file/write stderr "\n")))) |       (file/write stderr "\n")))) | ||||||
|  |  | ||||||
| (defn eval | (defn eval-string | ||||||
|   "Evaluates a string in the current environment. If more control over the |   "Evaluates a string in the current environment. If more control over the | ||||||
|   environment is needed, use run-context." |   environment is needed, use run-context." | ||||||
|   [str] |   [str] | ||||||
| @@ -1258,6 +1258,15 @@ value, one key will be ignored." | |||||||
|                "eval") |                "eval") | ||||||
|   returnval) |   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 | (do | ||||||
|   (def syspath (or (os/getenv "JANET_PATH") "/usr/local/lib/janet/")) |   (def syspath (or (os/getenv "JANET_PATH") "/usr/local/lib/janet/")) | ||||||
|   (defglobal 'module/paths |   (defglobal 'module/paths | ||||||
| @@ -1288,6 +1297,7 @@ value, one key will be ignored." | |||||||
|        (string/replace ".so" ".dll" x)))) |        (string/replace ".so" ".dll" x)))) | ||||||
|  |  | ||||||
| (defn module/find | (defn module/find | ||||||
|  |   "Try to match a module or path name from the patterns in paths." | ||||||
|   [path paths] |   [path paths] | ||||||
|   (def parts (string/split "/" path)) |   (def parts (string/split "/" path)) | ||||||
|   (def lastpart (get parts (- (length parts) 1))) |   (def lastpart (get parts (- (length parts) 1))) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose