GNU bug report logs - #14449
Guile 2.1 and macro nesting

Previous Next

Package: guile;

Reported by: Sanel Zukan <sanelz <at> gmail.com>

Date: Thu, 23 May 2013 14:05:01 UTC

Severity: normal

Done: Ian Price <ianprice90 <at> googlemail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14449 in the body.
You can then email your comments to 14449 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#14449; Package guile. (Thu, 23 May 2013 14:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sanel Zukan <sanelz <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Thu, 23 May 2013 14:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sanel Zukan <sanelz <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: Guile 2.1 and macro nesting
Date: Thu, 23 May 2013 15:50:32 +0200
Hi,

Looks like macro nesting (using define-macro) inside guile 2.x is no
longer possible. Here is example:

-----------------------------------------
scheme@(guile-user)>
(define-macro (def-caller abbrev proc)
    `(define-macro (,abbrev var expr)
       `(,',proc
         (lambda (,var) ,expr))))

scheme@(guile-user)> (def-caller katch call/cc)
scheme@(guile-user)> (macroexpand '(katch 3 (+ 1 1)))
ice-9/psyntax.scm:2146:53: In procedure #<procedure 282adc0 (args e1
e2)>:
ice-9/psyntax.scm:2146:53: Syntax error:
unknown location: lambda: invalid argument list in subform (3) of (3)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to
continue.
-----------------------------------------

However, doing the same in guile 1.x and/or any other Scheme
implementation where define-macro is native, it works without
problems.

Best,
Sanel




Reply sent to Ian Price <ianprice90 <at> googlemail.com>:
You have taken responsibility. (Thu, 03 Oct 2013 09:12:02 GMT) Full text and rfc822 format available.

Notification sent to Sanel Zukan <sanelz <at> gmail.com>:
bug acknowledged by developer. (Thu, 03 Oct 2013 09:12:03 GMT) Full text and rfc822 format available.

Message #10 received at 14449-done <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Sanel Zukan <sanelz <at> gmail.com>
Cc: 14449-done <at> debbugs.gnu.org
Subject: Re: bug#14449: Guile 2.1 and macro nesting
Date: Thu, 03 Oct 2013 10:11:30 +0100
tags 14449 notabug
thanks

Sanel Zukan <sanelz <at> gmail.com> writes:

> scheme@(guile-user)>
> (define-macro (def-caller abbrev proc)
>     `(define-macro (,abbrev var expr)
>        `(,',proc
>          (lambda (,var) ,expr))))
>
> scheme@(guile-user)> (def-caller katch call/cc)
> scheme@(guile-user)> (macroexpand '(katch 3 (+ 1 1)))
> ice-9/psyntax.scm:2146:53: In procedure #<procedure 282adc0 (args e1
> e2)>:
> ice-9/psyntax.scm:2146:53: Syntax error:
> unknown location: lambda: invalid argument list in subform (3) of (3)
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to
> continue.

Sorry it's taken so long. This is not a bug. You are using a number as
a variable in a lambda list, nothing to do with defmacro.

scheme@(guile-user)> (macroexpand '(lambda (3) (+ x 1)))
ice-9/psyntax.scm:2156:53: In procedure #<procedure 8e000a0 (args e1 e2)>:
ice-9/psyntax.scm:2156:53: Syntax error:
unknown location: lambda: invalid argument list in subform (3) of (3)

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.


If you use a variable name, it works correctly.


scheme@(guile-user)> (define-macro (def-caller abbrev proc)
    `(define-macro (,abbrev var expr)
       `(,',proc
         (lambda (,var) ,expr))))
scheme@(guile-user)> (def-caller katch call/cc)
scheme@(guile-user)> (macroexpand '(katch x (+ 1 1)))
$2 = #<tree-il (call (toplevel call/cc) (lambda () (lambda-case (((x) #f
    #f #f () (x-478)) (call (toplevel +) (const 1) (const 1))))))>
scheme@(guile-user)> ,expand (katch a (+ 1 1))
$3 = (call/cc (lambda (a) (+ 1 1)))
scheme@(guile-user)> (katch a (+ 1 (a 3)))
$4 = 3


I'm closing this one.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 31 Oct 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.