diff options
| author | 2025-07-13 18:35:56 -0500 | |
|---|---|---|
| committer | 2025-07-13 18:35:56 -0500 | |
| commit | ddc122958be34a18edd754743851536b5a16a3cc (patch) | |
| tree | 3abc842385f8725e08c54ee86d4d902c98345d7e /src | |
| parent | Remove extra call to filewatcher - address #1608 (diff) | |
| parent | Add tests for import arg validation (diff) | |
Merge pull request #1607 from sarna/master
Clarify :fresh usage in import
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot/boot.janet | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 0e357eec..61f6fd63 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -3181,12 +3181,17 @@ use the name of the module as a prefix. One can also use "`:export true`" to re-export the imported symbols. If "`:exit true`" is given as an argument, any errors encountered at the top level in the module will cause `(os/exit 1)` - to be called. Dynamic bindings will NOT be imported. Use :fresh to bypass the - module cache. Use `:only [foo bar baz]` to only import select bindings into the - current environment.`` + to be called. Dynamic bindings will NOT be imported. Use :fresh with a truthy + value to bypass the module cache. Use `:only [foo bar baz]` to only import + select bindings into the current environment.`` [path & args] + (assertf (even? (length args)) "args should have even length: %n" args) (def ps (partition 2 args)) - (def argm (mapcat (fn [[k v]] [k (case k :as (string v) :only ~(quote ,v) v)]) ps)) + (def argm + (mapcat (fn [[k v]] + (assertf (keyword? k) "expected keyword, got %s: %n" (type k) k) + [k (case k :as (string v) :only ~(quote ,v) v)]) + ps)) (tuple import* (string path) ;argm)) (defmacro use |
