bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: `set!' of generated temporary in macro expansion causes warning


From: Stefan Israelsson Tampe
Subject: Fwd: `set!' of generated temporary in macro expansion causes warning
Date: Mon, 13 Jun 2011 15:50:26 +0200



---------- Forwarded message ----------
From: Stefan Israelsson Tampe <address@hidden>
Date: Mon, Jun 13, 2011 at 1:03 PM
Subject: Re: `set!' of generated temporary in macro expansion causes warning
To: Andreas Rottmann <address@hidden>


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.

Be aware that changing this can pollute  current-module

/Stefan




On Mon, Jun 13, 2011 at 12:10 PM, Andreas Rottmann <address@hidden> wrote:
Hi!

This is a much-stripped-down version of a `define-values' macro,
exposing what seems like a psyntax bug:

% cat guile-psyntax-temp-set-issue.scm
(define-syntax define+set!
 (lambda (form)
   (syntax-case form ()
     ((_)
      (with-syntax (((mutable-id) (generate-temporaries '(id))))
        #'(begin
            (define mutable-id #f)
            (set! mutable-id #t)))))))

(define+set!)

% guile guile-psyntax-temp-set-issue.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/rotty/tmp/guile-psyntax-temp-set-issue.scm

;;; WARNING (module system is booted, we should have a module #{ g65}#)
;;; compiled /home/rotty/.cache/guile/ccache/2.0-LE-8-2.0/home/rotty/tmp/guile-psyntax-temp-set-issue.scm.go

Note the WARNING line; it seems during expansion something goes wrong
wrt. to modules -- it'd be really nice if some psyntax guru can have a
look at this.

Regards, Rotty
--
Andreas Rottmann -- <http://rotty.yi.org/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]