unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Endless loop in guile 1.6.1 if using macros
@ 2003-01-18 12:41 Christian Neukirchen
  2003-01-18 14:42 ` Mikael Djurfeldt
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Neukirchen @ 2003-01-18 12:41 UTC (permalink / raw)


Hello,

The following program will make guile 1.6.1 enter an endless loop
while garbage collecting.

Put this into `module.scm':

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (define-module (module)
    :use-syntax (ice-9 syncase))
  
  (export f)
  
  (define-syntax ds
    (syntax-rules ()
      ((ds a) (string-append a " (by define-syntax)\n"))))
  
  (define (f)
    (display "In F.\n")
    (display (ds "In F")))
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

And this into `main.scm':

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (use-modules (module))
  (f)
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

If you run this now:

  $ guile -s main.scm
  In F.
               <-- Endless loop!

However, if you change the

  (export f)

into
  
  (export f ds)

everything works correctly!

  $ guile -s main.scm
  In F.
  In F (by define-syntax)

Therefore I think, all macros used by exported guile functions have to
get exported too.

This bug seems to appear in guile 1.6 only, since I talked to the mixp
developer, he uses guile 1.7 and can't reproduce it.

If you have patches, could you please CC: them to me?

Happy hacking,
  Christian Neukirchen <chneukirchen@yahoo.de>


__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Endless loop in guile 1.6.1 if using macros
  2003-01-18 12:41 Endless loop in guile 1.6.1 if using macros Christian Neukirchen
@ 2003-01-18 14:42 ` Mikael Djurfeldt
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Djurfeldt @ 2003-01-18 14:42 UTC (permalink / raw)
  Cc: djurfeldt

Christian Neukirchen <chneukirchen@yahoo.de> writes:

> Therefore I think, all macros used by exported guile functions have to
> get exported too.

That is correct.  Finally, that won't be necessary, but currently it
is.  This has to do with the fact that the original implementation of
syntax-case macros which Guile uses is not written for use with a
module system.  We have in mind to fix it, but it is not fixed yet.

> This bug seems to appear in guile 1.6 only, since I talked to the mixp
> developer, he uses guile 1.7 and can't reproduce it.

I recently got the syncase module to expand Guile macros as well.  The
effect is that the (ds ...) form in your example is expanded already
at the definition of f.  So while syncase macros are still not fully
integrated with the module system => you *should* always export
bindings inserted by the macro as well, it happens to work in 1.7 in
this particular case.

> If you have patches, could you please CC: them to me?

The development source tree of guile-1.7 is publicly available via the
Guile homepage.  You can use the cvs diff command to obtain patches.

Best regards,
Mikael D.


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-18 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-18 12:41 Endless loop in guile 1.6.1 if using macros Christian Neukirchen
2003-01-18 14:42 ` Mikael Djurfeldt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).