From 5b9eda5e87710e55dca7c001b6a08ffce713b231 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Thu, 12 Dec 2019 17:25:04 -0600 Subject: [PATCH] Add root-env This makes images smaller without needing to make sure that no references to the root environment occur in the final image. --- CHANGELOG.md | 1 + src/boot/boot.janet | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6ff822..3836f295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file. - Add `comptime` macro for compile time evaluation. - Run `main` functions in scripts if they exist, just like jpm standalone binaries. - Add `protect` macro. +- Add `root-env` to get the root environment table. - Change marshalling protocol with regard to abstract types. - Numerous small bug fixes and usability improvements. diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 15c7e1b8..c310efb2 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -2271,11 +2271,14 @@ ### ### +(def root-env "The root environment used to create envionments with (make-env)" _env) + (do (put _env 'boot/opts nil) (put _env '_env nil) - (merge-into load-image-dict (env-lookup _env)) - (merge-into make-image-dict (invert load-image-dict))) + (def load-dict (env-lookup _env)) + (merge-into load-image-dict load-dict) + (merge-into make-image-dict (invert load-dict))) ### ###