Evan Hanson <[email protected]> writes: > If I understand correctly, this would effectively be an "unexport" of > sorts, like so:
Yes, that's what I was thinking. > > Is that right? Personally, I'd rather make (declare (hide ...)) simply > do the right thing -- the right thing being the behaviour you originally > expected when filing #1376 -- than add a new type of declaration or > module syntax. Here's a quick POC doing this. It filters out all identifiers marked 'hidden from the syntax-exports and variable exports lists in ##sys#finalize-module. It doesn't touch the indirect exports list. I'm not sure how that should be handled. Applies to the 4.12.0 tarball. If you think this is a valid approach I can clean it up and add some tests.
diff --git a/modules.scm b/modules.scm index aeeabcf..b5788b1 100644 --- a/modules.scm +++ b/modules.scm @@ -447,23 +447,36 @@ (dlist (module-defined-list mod)) (elist (module-exist-list mod)) (missing #f) + ;; from support.scm + (variable-hidden? (lambda (sym) + (print "hidden? " sym " " + (eq? (##sys#get sym '##compiler#visibility) 'hidden)) + (eq? (##sys#get sym '##compiler#visibility) 'hidden))) + (id-hidden? (lambda (id) + (variable-hidden? (##sys#module-rename id name)))) (sdlist (map (lambda (sym) (assq (car sym) (##sys#macro-environment))) (module-defined-syntax-list mod))) (sexports - (if (eq? #t explist) - (merge-se (module-sexports mod) sdlist) - (let loop ((me (##sys#macro-environment))) - (cond ((null? me) '()) - ((##sys#find-export (caar me) mod #f) - (cons (car me) (loop (cdr me)))) - (else (loop (cdr me))))))) + (let loop [(sxs (if (eq? #t explist) + (merge-se (module-sexports mod) sdlist) + (let loop ((me (##sys#macro-environment))) + (cond ((null? me) '()) + ((##sys#find-export (caar me) mod #f) + (cons (car me) (loop (cdr me)))) + (else (loop (cdr me)))))))] + (cond + ((null? sxs) '()) + ((id-hidden? (caar sxs)) (loop (cdr sxs))) + (else + (cons (car sxs) (loop (cdr sxs))))))) (vexports (let loop ((xl (if (eq? #t explist) elist explist))) (if (null? xl) '() (let* ((h (car xl)) (id (if (symbol? h) h (car h)))) - (if (assq id sexports) + (if (or (assq id sexports) + (id-hidden? id)) (loop (cdr xl)) (cons (cons
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
