From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.bugs Subject: bug#32847: Wrong macro expansion in eval Date: Thu, 27 Sep 2018 10:33:00 +0200 Message-ID: References: <875zyrelcp.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007c19070576d630ce" X-Trace: blaine.gmane.org 1538037127 11301 195.159.176.226 (27 Sep 2018 08:32:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2018 08:32:07 +0000 (UTC) Cc: 32847@debbugs.gnu.org To: Mark H Weaver Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Sep 27 10:32:03 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5RiM-0002px-Ew for guile-bugs@m.gmane.org; Thu, 27 Sep 2018 10:32:02 +0200 Original-Received: from localhost ([::1]:34441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5RkS-00075a-3s for guile-bugs@m.gmane.org; Thu, 27 Sep 2018 04:34:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5RkL-00075R-Df for bug-guile@gnu.org; Thu, 27 Sep 2018 04:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5RkI-0007NG-4Z for bug-guile@gnu.org; Thu, 27 Sep 2018 04:34:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5RkH-0007Mu-UQ for bug-guile@gnu.org; Thu, 27 Sep 2018 04:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g5RkH-0003hG-KO for bug-guile@gnu.org; Thu, 27 Sep 2018 04:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Israelsson Tampe Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 27 Sep 2018 08:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32847 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 32847-submit@debbugs.gnu.org id=B32847.153803720014155 (code B ref 32847); Thu, 27 Sep 2018 08:34:01 +0000 Original-Received: (at 32847) by debbugs.gnu.org; 27 Sep 2018 08:33:20 +0000 Original-Received: from localhost ([127.0.0.1]:55883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5Rjb-0003gF-SW for submit@debbugs.gnu.org; Thu, 27 Sep 2018 04:33:20 -0400 Original-Received: from mail-vs1-f43.google.com ([209.85.217.43]:38505) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5RjZ-0003g2-Rj for 32847@debbugs.gnu.org; Thu, 27 Sep 2018 04:33:18 -0400 Original-Received: by mail-vs1-f43.google.com with SMTP id y11-v6so1017193vso.5 for <32847@debbugs.gnu.org>; Thu, 27 Sep 2018 01:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UfnyrWrIcW9TRAvO3Ngw96oouNBGpcUDJHXg6YF+eQs=; b=rvxmdRSBCOjAd7ppboFbMr4jeCYhEB9dQNkVwUMxesX2XwS6d97l3QuByL0YMfbLPr hmex1pHHPL5yFQ1X7AXlogK6M9qMra1Svw8HDu2OxAPNEUcNuQxkykVIEvTKec2u7PmA P5JVxjtpL+z5tlFC2LaEqIb77/HhvuQ0uFatmgfL3T9MPO9FzZz3d02CktMOFZQnnhvs D153d4+lOwLmzdvc4CwCH91n4AvPArLwBJ9oH3I1KXaeWoxVLWL4ZlsARvniU4swdQ2W lIzEZ0sR8Um5VFQS+InTDXPZI2CZPzCpQpx7ulr3E/nw84yyZv1/l0c5F2jP1J9v5TiP m7TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UfnyrWrIcW9TRAvO3Ngw96oouNBGpcUDJHXg6YF+eQs=; b=NYDb1wd3E3/STvYtdXEh9Abh00BcLcW+oJvGAcY4wvCiibZw2vj7jb9rgxjntF/854 o4YBto9CzSesvH/5BaT7PqKHGkGYXtcKjPNfSeuowel/v1bp1kfQrELzpPW+TznbEmGc YitYubhOJXAydGLnnxo2qH/StIcTSp76VLR4RsmCmSchbuXuZx+y5xmMXJooM7VNGaTm UA6Xk4OIoSy4+JDK5Vfx6Ara29mgJGEytbU1jXgF6JXbSRT57yImwOxtgqAUTIY4/1je 8YNKgBfOJA4HlgFHuSY2qV9XiV5vtn9Nk3uL2JLRHz12S4kbqNBHOGQl1jfTjSFuMScJ gBDQ== X-Gm-Message-State: ABuFfoh7i8Is8viFl0njr4CWeacdASubTun297ywpOIga+Ta1WqXzdvy PRKUNfT79vtZWpqCM01xDUZ5ZwcSBarHcsOU364= X-Google-Smtp-Source: ACcGV60h0lE1JyQu6TzpnW9BzmINSxeMhjHE10y++Z3yIKgKziU9A/+co4P/2/CRMM9c3GvN5w3kQZTVm2vCVoGZZj4= X-Received: by 2002:a67:d803:: with SMTP id e3-v6mr3032775vsj.163.1538037192069; Thu, 27 Sep 2018 01:33:12 -0700 (PDT) In-Reply-To: <875zyrelcp.fsf@netris.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9175 Archived-At: --0000000000007c19070576d630ce Content-Type: text/plain; charset="UTF-8" yes that makes sense. thanks! On Thu, Sep 27, 2018 at 4:16 AM Mark H Weaver wrote: > Hi Stefan, > > Stefan Israelsson Tampe writes: > > > This for guile 2.4 and master, > > > >> (eval `(let-syntax ((f (lambda (x) ,#'(+ (pk 'a 1) 2)))) f) > (current-module)) > > > > ;;; (# 1) > > > > But without eval: > >> (let-syntax ((f (lambda (x) #'(+ (pk 'a 1) 2)))) f) > > > > ;;; (a 1) > > I think the mistake is in your code above. In the first case, what you > want is this: > > (eval `(let-syntax ((f (lambda (x) ,'#'(+ (pk 'a 1) 2)))) f) > (current-module)) > > Note the addition of a quote (') between the unquote (,) and syntax (#') > above. > > The expression that follows unquote (,) should evaluate to an > s-expression. In this case, you want it to evaluate to the s-expression > #'(+ (pk 'a 1) 2), i.e. (syntax (+ (pk 'a 1) 2)), i.e. a list with two > elements, the first being the symbol 'syntax'. But that's not what > you're doing above. Instead, you are returning the syntax object > itself, which is being spliced directly into the code. > > Does that make sense? > > Mark > --0000000000007c19070576d630ce Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
yes that makes sense. thanks!

On Thu, Sep 27, 2018 at 4:16 AM Mark H Weaver <= mhw@netris.org> wrote:
Hi Stefan,

Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

> This for guile 2.4 and master,
>
>> (eval `(let-syntax ((f (lambda (x) ,#'(+ (pk 'a 1) 2)))) f= ) (current-module))
>
> ;;; (#<syntax a> 1)
>
> But without eval:
>> (let-syntax ((f (lambda (x) #'(+ (pk 'a 1) 2)))) f)=C2=A0 =
>
> ;;; (a 1)

I think the mistake is in your code above.=C2=A0 In the first case, what yo= u
want is this:

=C2=A0 (eval `(let-syntax ((f (lambda (x) ,'#'(+ (pk 'a 1) 2)))= ) f)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (current-module))

Note the addition of a quote (') between the unquote (,) and syntax (#&= #39;)
above.

The expression that follows unquote (,) should evaluate to an
s-expression.=C2=A0 In this case, you want it to evaluate to the s-expressi= on
#'(+ (pk 'a 1) 2), i.e. (syntax (+ (pk 'a 1) 2)), i.e. a list w= ith two
elements, the first being the symbol 'syntax'.=C2=A0 But that's= not what
you're doing above.=C2=A0 Instead, you are returning the syntax object<= br> itself, which is being spliced directly into the code.

Does that make sense?

=C2=A0 =C2=A0 =C2=A0 =C2=A0Mark
--0000000000007c19070576d630ce--