mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 16:00:22 +02:00
* boot-9.scm (define-public): Changed to accomodate Hobbit.
This commit is contained in:
parent
8cedfb2e6c
commit
3c5af9ef9b
1 changed files with 21 additions and 18 deletions
|
@ -2488,28 +2488,31 @@
|
|||
(error "bad syntax" (list 'define-public args)))
|
||||
(define (defined-name n)
|
||||
(cond
|
||||
((symbol? n) n)
|
||||
((pair? n) (defined-name (car n)))
|
||||
(else (syntax))))
|
||||
((symbol? n) n)
|
||||
((pair? n) (defined-name (car n)))
|
||||
(else (syntax))))
|
||||
(cond
|
||||
((null? args) (syntax))
|
||||
((null? args) (syntax))
|
||||
|
||||
(#t (let ((name (defined-name (car args))))
|
||||
`(begin
|
||||
(let ((public-i (module-public-interface (current-module))))
|
||||
;; Make sure there is a local variable:
|
||||
;;
|
||||
(module-define! (current-module)
|
||||
',name
|
||||
(module-ref (current-module) ',name #f))
|
||||
(#t (let ((name (defined-name (car args))))
|
||||
`(begin
|
||||
(let ((public-i (module-public-interface (current-module))))
|
||||
;; Make sure there is a local variable:
|
||||
;;
|
||||
(module-define! (current-module)
|
||||
',name
|
||||
(module-ref (current-module) ',name #f))
|
||||
|
||||
;; Make sure that local is exported:
|
||||
;;
|
||||
(module-add! public-i ',name (module-variable (current-module) ',name)))
|
||||
;; Make sure that local is exported:
|
||||
;;
|
||||
(module-add! public-i ',name
|
||||
(module-variable (current-module) ',name)))
|
||||
|
||||
;; Now (re)define the var normally.
|
||||
;;
|
||||
(define-private ,@ args))))))
|
||||
;; Now (re)define the var normally. Bernard URBAN
|
||||
;; suggests we use eval here to accomodate Hobbit; it lets
|
||||
;; the interpreter handle the define-private form, which
|
||||
;; Hobbit can't digest.
|
||||
(eval '(define-private ,@ args)))))))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue