unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: Sanel Zukan <sanelz@gmail.com>
Cc: 14449-done@debbugs.gnu.org
Subject: bug#14449: Guile 2.1 and macro nesting
Date: Thu, 03 Oct 2013 10:11:30 +0100	[thread overview]
Message-ID: <87fvsiwwfx.fsf@googlemail.com> (raw)
In-Reply-To: <CAHuZ_ku2bz8+qFDRd1DyrH2yF-wxovdHf7dLWyB-_j=8P=JqTQ@mail.gmail.com> (Sanel Zukan's message of "Thu, 23 May 2013 15:50:32 +0200")

tags 14449 notabug
thanks

Sanel Zukan <sanelz@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"





      reply	other threads:[~2013-10-03  9:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 13:50 bug#14449: Guile 2.1 and macro nesting Sanel Zukan
2013-10-03  9:11 ` Ian Price [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvsiwwfx.fsf@googlemail.com \
    --to=ianprice90@googlemail.com \
    --cc=14449-done@debbugs.gnu.org \
    --cc=sanelz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).