Hi all, Currently we have to do (import (only chicken when unless handle-exceptions)) somewhere in library.scm. We can't import them from (chicken base) and (chicken condition), because those modules are also being declared in library.scm.
The definitions of these modules in library.scm are incomplete: they don't contain the syntactic exports; those are handled in the hand-crafted import libraries which take the syntactic environments as prepared by expand.scm / chicken-syntax.scm / modules.scm (yeah it's complex). Because the modules themselves are declared in library.scm, trying to import from them later on will use those definitions rather than the definitions from the import libraries (the compiler won't go looking in the filesystem for modules that you just declared). Therefore, we can't use the macros exported by the import libraries corresponding to those modules. Like I mentioned in the initial paragrah, currently, we work around that by importing them from the "chicken" module. Because this module will eventually disappear, we need something special to get at those nonstandard macros. The attached patch trivially adds a new internal, undocumented module called (chicken internal built-in-core-macros). I briefly thought about naming it ##sys#built-in-core-macros. We could also do that, instead. In any case, we need something like this before the next pre-snapshot (pre4?) so that we can drop the chicken module after that has been made. Cheers, Peter
From 20035ec2cbd28d9fa0f6133a404acd59c4c5f5e4 Mon Sep 17 00:00:00 2001 From: Peter Bex <[email protected]> Date: Tue, 31 Oct 2017 21:00:39 +0100 Subject: [PATCH] Add module hack so library.scm can refer to built-in core macros This is necessary because library.scm is defining some modules, from which it also uses macros. For "scheme" this is possible because it is built-in as a special case but for srfi-12/(chicken condition) and (chicken base) we can't import them from those libraries themselves. Currently we get by through the "chicken" module which contains secondary exports for all these macros because they used to be available from that module, but the "chicken" module will disappear soonish. This commit is in preparation for the drop of the "chicken" module, which can then be done once we make a prerelease snapshot containing this change. We can then add the following import to library.scm: (import (chicken internal built-in-core-macros)) The module's name is intentionally long and contains references to "internal" and "built-in" and "core" to be vague and dissuasive so that nobody will start using them (or at least on their own risk). --- modules.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules.scm b/modules.scm index c1895127..653baba0 100644 --- a/modules.scm +++ b/modules.scm @@ -1075,6 +1075,10 @@ (define-inline (se-subset names env) (map (cut assq <> env) names)) +;; Hack for library.scm to use macros from modules it defines itself. +(##sys#register-core-module + 'chicken.internal.built-in-core-macros #f '() (##sys#macro-environment)) + (##sys#register-core-module 'chicken.module #f '() ##sys#chicken.module-macro-environment) -- 2.11.0
signature.asc
Description: PGP signature
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
