[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `set!' of generated temporary in macro expansion causes warning
From: |
Andreas Rottmann |
Subject: |
Re: `set!' of generated temporary in macro expansion causes warning |
Date: |
Mon, 13 Jun 2011 14:10:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Stefan Israelsson Tampe <address@hidden> writes:
> It looks like you just put the symbol in the current module, so maybe the
> warning is
> just unessesary.
>
> here is the code in psyntax:
>
> (define get-global-definition-hook
> (lambda (symbol module)
> (if (and (not module) (current-module))
> (warn "module system is booted, we should have a module"
> symbol))
> (let ((v (module-variable (if module
> (resolve-module (cdr module))
> (current-module))
> symbol)))
>
>
> so module parameter beeing #f will lead to a warning and an evaluation of
> (module-variable (current-module) symbol)
>
> So if it's ok for the temporaries to be in the current-module then the
> warning need to silenced.
>
> E.g. In
> (set! generate-temporaries
> (lambda (ls)
> (arg-check list? ls 'generate-temporaries)
> (map (lambda (x) (wrap (gensym-hook) top-wrap #f)) ls)))
>
> Replace #f with (current-module) and you will not have a warning. But My
> psyntax-fu is
> weak so this is just my 2c
>
Thanks; I've now locally applied this patch:
From: Andreas Rottmann <address@hidden>
Subject: Silence warnings for variables created by `generate-temporaries'
---
module/ice-9/psyntax.scm | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index 5380ba7..788eefd 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -2428,7 +2428,8 @@
(set! generate-temporaries
(lambda (ls)
(arg-check list? ls 'generate-temporaries)
- (map (lambda (x) (wrap (gensym-hook) top-wrap #f)) ls)))
+ (let ((mod (cons 'hygiene (module-name (current-module)))))
+ (map (lambda (x) (wrap (gensym-hook) top-wrap mod)) ls))))
(set! free-identifier=?
(lambda (x y)
--
tg: (589bc52..) t/generate-temporaries (depends on: stable-2.0)
It seems to work OK, but I have no idea if it is really "correct".
Regards, Rotty
Message not available