unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Nala Ginrut <nalaginrut@gmail.com>
Cc: 18245@debbugs.gnu.org, request@debbugs.gnu.org
Subject: bug#18245: [master branch] Useless imported module cause strange problem
Date: Mon, 11 Aug 2014 11:30:32 -0400	[thread overview]
Message-ID: <874mxjqc13.fsf@yeeloong.lan> (raw)
In-Reply-To: <1407748488.5167.7.camel@Renee-desktop.suse> (Nala Ginrut's message of "Mon, 11 Aug 2014 17:14:48 +0800")

tags 18245 notabug
close 18245
thanks

Nala Ginrut <nalaginrut@gmail.com> writes:
> I've imported srfi-1, but after some modifications, the program happens
> not to use any srfi-1 symbols, then there's the problem that one of the
> rule in syntax-rules can't be found and threw error.
> It works when I removed useless srfi-1 from imported list.

The problem is that srfi-1 exports a 'drop' procedure, and 'drop' is
also used as a syntax-rules literal in your macros.  Literals are
matched as follows: if the literal identifier has the same name and the
same binding where the macro is defined and where it is used, then
there's a match.  If the identifier is not bound in either place, then
there's also a match.

However, in this case 'drop' is not defined where the 'sql-alter' macro
is defined, but it _is_ defined to a procedure in srfi-1 in your example
module where it is used.  Therefore, the macro does not consider the
'drop' to be a match for the literal it's looking for.

This is similar to the issue that if you define 'else' to be something
in a module (or import it from somewhere), then 'else' will no longer
have its special meaning in a 'cond' form.  Ditto for '=>'.

There is some question about whether these rules for matches literals
are the best ones, and the issue has been debated during the R7RS
standardization process, but nonetheless the standards are clear on this
matter.

I recommend choosing literals that are not likely to be bound in modules
that use your sql macros.

I'm closing this.

     Regards,
       Mark





  reply	other threads:[~2014-08-11 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  9:14 bug#18245: [master branch] Useless imported module cause strange problem Nala Ginrut
2014-08-11 15:30 ` Mark H Weaver [this message]
2014-08-12  1:46   ` Nala Ginrut

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=874mxjqc13.fsf@yeeloong.lan \
    --to=mhw@netris.org \
    --cc=18245@debbugs.gnu.org \
    --cc=nalaginrut@gmail.com \
    --cc=request@debbugs.gnu.org \
    /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).