mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
allow redefinition of global macros to variables
* module/ice-9/psyntax.scm: Allow the redefinition of keywords to variables. Otherwise we can't do (define let #f), which is totally useful and stuff. * module/ice-9/psyntax-pp.scm: Regenerated.
This commit is contained in:
parent
85e95b4710
commit
c5ad45c7b3
2 changed files with 28 additions and 17 deletions
File diff suppressed because one or more lines are too long
|
@ -350,6 +350,16 @@
|
|||
;; Properties are tied to variable objects
|
||||
(set-object-property! v '*sc-expander* binding))))
|
||||
|
||||
(define remove-global-definition-hook
|
||||
(lambda (symbol modname)
|
||||
(let* ((module (if modname
|
||||
(resolve-module modname)
|
||||
(current-module)))
|
||||
(v (module-local-variable module symbol)))
|
||||
(if v
|
||||
(let ((p (assq '*sc-expander* (object-properties v))))
|
||||
(set-object-properties! v (delq p (object-properties v))))))))
|
||||
|
||||
(define get-global-definition-hook
|
||||
(lambda (symbol module)
|
||||
(let* ((module (if module
|
||||
|
@ -1104,13 +1114,14 @@
|
|||
mod))
|
||||
((displaced-lexical)
|
||||
(syntax-error (wrap value w mod) "identifier out of context"))
|
||||
((core macro module-ref)
|
||||
(remove-global-definition-hook n mod)
|
||||
(eval-if-c&e m
|
||||
(build-global-definition s n (chi e r w mod) mod)
|
||||
mod))
|
||||
(else
|
||||
(if (eq? type 'external-macro)
|
||||
(eval-if-c&e m
|
||||
(build-global-definition s n (chi e r w mod) mod)
|
||||
mod)
|
||||
(syntax-error (wrap value w mod)
|
||||
"cannot define keyword at top level"))))))
|
||||
(syntax-error (wrap value w mod)
|
||||
"cannot define keyword at top level")))))
|
||||
(else (eval-if-c&e m (chi-expr type value e r w s mod) mod)))))))
|
||||
|
||||
(define chi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue