From d070973134118a5ffe41b3153a908dcda3403322 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Fri, 1 Nov 2024 12:44:48 +0100 Subject: [PATCH] use $:import name for importing ES Modules --- docs/docs/lips/intro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/lips/intro.md b/docs/docs/lips/intro.md index 9dde74d9..339d1cbc 100644 --- a/docs/docs/lips/intro.md +++ b/docs/docs/lips/intro.md @@ -1007,13 +1007,13 @@ LIPS Scheme runs in ES Module, but `import` is reserved for experimental R7RS mo to import module that is ESM only. You need to access JavaScript dynamic import. But `global.import` is not defined. If you want to define JavaScript dynamic import, you can use code: ```scheme -(define import (global.eval "(x) => import(x)")) +(define $:import (global.eval "(x) => import(x)")) ``` You can use this function like this: ```javascript -(--> (import "fs/promises") (readFile "README.md" "utf8")) +(--> ($:import "fs/promises") (readFile "README.md" "utf8")) ``` But it will also work with ESM only module that can't be imported with `require`.