mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Add *module/make-env*
This commit is contained in:
parent
9946f3bdf4
commit
fdaf2e1594
@ -2,6 +2,8 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased - ???
|
## Unreleased - ???
|
||||||
|
- Add *module/make-env* dynamic binding
|
||||||
|
- Add buffer/format-at
|
||||||
- Add long form command line options for readable CLI usage
|
- Add long form command line options for readable CLI usage
|
||||||
- Fix bug with `net/accept-loop` that would sometimes miss connections.
|
- Fix bug with `net/accept-loop` that would sometimes miss connections.
|
||||||
|
|
||||||
|
@ -2771,6 +2771,7 @@
|
|||||||
(defdyn *module/paths* "Dynamic binding for overriding `module/cache`")
|
(defdyn *module/paths* "Dynamic binding for overriding `module/cache`")
|
||||||
(defdyn *module/loading* "Dynamic binding for overriding `module/cache`")
|
(defdyn *module/loading* "Dynamic binding for overriding `module/cache`")
|
||||||
(defdyn *module/loaders* "Dynamic binding for overriding `module/loaders`")
|
(defdyn *module/loaders* "Dynamic binding for overriding `module/loaders`")
|
||||||
|
(defdyn *module/make-env* "Dynamic binding for creating new environments for `import`, `require`, and `dofile`. Overrides `make-env`.")
|
||||||
|
|
||||||
(def module/cache
|
(def module/cache
|
||||||
"A table, mapping loaded module identifiers to their environments."
|
"A table, mapping loaded module identifiers to their environments."
|
||||||
@ -2958,7 +2959,7 @@
|
|||||||
:core/stream path
|
:core/stream path
|
||||||
(file/open path :rb)))
|
(file/open path :rb)))
|
||||||
(def path-is-file (= f path))
|
(def path-is-file (= f path))
|
||||||
(default env (make-env (curenv)))
|
(default env ((dyn *module/make-env* make-env)))
|
||||||
(def spath (string path))
|
(def spath (string path))
|
||||||
(put env :source (or source (if-not path-is-file spath path)))
|
(put env :source (or source (if-not path-is-file spath path)))
|
||||||
(var exit-error nil)
|
(var exit-error nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user