diff options
author | Andy Wingo <wingo@pobox.com> | 2009-04-23 11:25:22 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-04-23 11:25:22 +0200 |
commit | 819cf0e8b8f09e769e194781ec57a52f9415763b (patch) | |
tree | e9eeae27d8f2add4f19b4a3e1c34dadab74f3590 | |
parent | 8239263f86e9d3782482e4da4b91d8fe490ac4ac (diff) | |
download | guile-819cf0e8b8f09e769e194781ec57a52f9415763b.tar.gz |
I ain't broke, but brother I'm badly bent
* module/ice-9/expand-support.scm (strip-expansion-structures): If, when
producing @/@@ forms, we find that an @@ variable is not bound in its
module, just serialize the symbol. This bends hygiene, in that it can
introduce a global (but not lexical) reference in the expanded module,
but it seems necessary to not produce (@@ (foo) else) in forms like
((@@ (foo) cond) ((test then) ((@@ (foo) else) bar))).
-rw-r--r-- | module/ice-9/expand-support.scm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/module/ice-9/expand-support.scm b/module/ice-9/expand-support.scm index 63ea2d2b1..372d959a5 100644 --- a/module/ice-9/expand-support.scm +++ b/module/ice-9/expand-support.scm @@ -149,13 +149,19 @@ (set-source-properties! e source)) e)) ((module-ref? e) - (if (and (module-ref-modname e) - (not (eq? (module-ref-modname e) - (module-name (current-module))))) - `(,(if (module-ref-public? e) '@ '@@) - ,(module-ref-modname e) - ,(module-ref-symbol e)) - (module-ref-symbol e))) + (cond + ((or (not (module-ref-modname e)) + (eq? (module-ref-modname e) + (module-name (current-module))) + (and (not (module-ref-public? e)) + (not (module-variable + (resolve-module (module-ref-modname e)) + (module-ref-symbol e))))) + (module-ref-symbol e)) + (else + `(,(if (module-ref-public? e) '@ '@@) + ,(module-ref-modname e) + ,(module-ref-symbol e))))) ((lexical? e) (lexical-gensym e)) ((record? e) |