From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Flatt Newsgroups: gmane.comp.lang.racket.devel,gmane.lisp.guile.devel Subject: Re: Enhancement to the syntax system? Date: Tue, 10 Jul 2012 09:03:14 -0600 Message-ID: <20120710150315.B7B27650059@mail-svr1.cs.utah.edu> References: <877gumufmq.fsf@gnu.org> <87r4stss4d.fsf@gnu.org> <878vf0o7gs.fsf@gnu.org> <87pq85dj8o.fsf@gnu.org> <87sjd058ia.fsf@gnu.org> <4FFC3D72.8070506@gentoo.org> <20476.16781.257276.194149@winooski.ccs.neu.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1341932624 31281 80.91.229.3 (10 Jul 2012 15:03:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Jul 2012 15:03:44 +0000 (UTC) Cc: "dev-GvBox1K3Ixw1Q5oZIJT9Xw@public.gmane.org" , Ludovic =?ISO-8859-1?Q?Court=E8s?= , guile-devel-mXXj517/zsQ@public.gmane.org To: Eli Barzilay Original-X-From: dev-bounces-GvBox1K3Ixw1Q5oZIJT9Xw@public.gmane.org Tue Jul 10 17:03:41 2012 Return-path: Envelope-to: gclrd-dev-1dZseelyfdZg9hUCZPvPmw@public.gmane.org Original-Received: from champlain.ccs.neu.edu ([129.10.115.116]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SobyX-0008Iq-C9 for gclrd-dev-1dZseelyfdZg9hUCZPvPmw@public.gmane.org; Tue, 10 Jul 2012 17:03:41 +0200 Original-Received: from champlain.ccs.neu.edu (localhost.localdomain [127.0.0.1]) by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q6AF3OOx021162; Tue, 10 Jul 2012 11:03:25 -0400 Original-Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q6AF3KOO021157 for ; Tue, 10 Jul 2012 11:03:20 -0400 Original-Received: by wibhr14 with SMTP id hr14so3607168wib.3 for ; Tue, 10 Jul 2012 08:03:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :x-virus-scanned:mime-version:content-type:content-transfer-encoding :from:to:cc:subject:date:in-reply-to:references:x-mailer:x-uptime :message-id:x-gm-message-state; bh=NU2bNqyGUuPbSCYXlXjtIaSAPMD90OmT2r4NqzRh/8E=; b=lTOyHvy6GZ8CalQcpRpRfKkGV8r8a9MhhuRe70RJKqpO322nZfHg5/JUIrjeS4MYrV O9yqH5lpMpilRDzyWJeccjEYTHlVQWJdvCE7kNEIjNXX7ZNTmfK4XS3ympVtqvK2Qur1 lPhqYAJnNybCoqZ+/9W1/Ksdnq8EzFpFGh4lE/bKXhi4Y7vMy7dyHlR0cs8ZFE/pSWfA rIDTiRdkfx1llN36mAkG2aBQtJGk4lV+z82tsGC6WFjvYhvoMC4eEZySmqhR429SvNiq Nc/npvYGgp8WJsubyz1oIsX5pXGj+VOWAJrO4PAjFHAYZ1YvhgPHnOlaQ0JEspi5qUII eoIA== Original-Received: by 10.180.79.229 with SMTP id m5mr39023081wix.13.1341932600107; Tue, 10 Jul 2012 08:03:20 -0700 (PDT) X-Forwarded-To: dev-ETbvJ2rUIr5TJLIrbSsYWiH1kwoRJHTR@public.gmane.org X-Forwarded-For: dev-PQOLPrHdAZ4YeIxN5WHPnw@public.gmane.org dev-ETbvJ2rUIr5TJLIrbSsYWiH1kwoRJHTR@public.gmane.org Original-Received: by 10.194.56.229 with SMTP id d5csp248748wjq; Tue, 10 Jul 2012 08:03:19 -0700 (PDT) Original-Received: by 10.50.195.234 with SMTP id ih10mr11795517igc.0.1341932599019; Tue, 10 Jul 2012 08:03:19 -0700 (PDT) Original-Received: from mail-svr1.cs.utah.edu (rio.cs.utah.edu. [155.98.64.241]) by mx.google.com with ESMTP id oz2si18146151igc.52.2012.07.10.08.03.18; Tue, 10 Jul 2012 08:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of mflatt-sDh8Nw2yj/+Vc3sceRu5cw@public.gmane.org designates 155.98.64.241 as permitted sender) client-ip=155.98.64.241; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mflatt-sDh8Nw2yj/+Vc3sceRu5cw@public.gmane.org designates 155.98.64.241 as permitted sender) smtp.mail=mflatt-sDh8Nw2yj/+Vc3sceRu5cw@public.gmane.org Original-Received: from localhost (localhost [127.0.0.1]) by mail-svr1.cs.utah.edu (Postfix) with ESMTP id E7FE46500AF; Tue, 10 Jul 2012 09:03:17 -0600 (MDT) X-Virus-Scanned: amavisd-new at cs.utah.edu Original-Received: from mail-svr1.cs.utah.edu ([127.0.0.1]) by localhost (mail-svr1.cs.utah.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iN76ipKYVZbr; Tue, 10 Jul 2012 09:03:17 -0600 (MDT) Original-Received: from localhost (c-67-172-254-180.hsd1.ut.comcast.net [67.172.254.180]) by smtps.cs.utah.edu (Postfix) with ESMTPSA id B7B27650059; Tue, 10 Jul 2012 09:03:15 -0600 (MDT) In-Reply-To: <20476.16781.257276.194149-a5nvgYPMCZcx/1z6v04GWfZ8FUJU4vz8@public.gmane.org> X-Mailer: SirMail under GRacket 5.3.0.13 (x86_64-macosx/3m) X-Uptime: 14 hours and 13 minutes, using 366,668,848 bytes (s: 7242) X-Gm-Message-State: ALoCoQkxJ/3fQRkmK25v1bfEjy3sW1yMX1hgr1O7314AucP/sxA3UYfrMIu/zzxJYQj8V5MGUDd9 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on champlain.ccs.neu.edu X-BeenThere: dev-GvBox1K3Ixw1Q5oZIJT9Xw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Racket Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: dev-bounces-GvBox1K3Ixw1Q5oZIJT9Xw@public.gmane.org Errors-To: dev-bounces-GvBox1K3Ixw1Q5oZIJT9Xw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.racket.devel:6398 gmane.lisp.guile.devel:14729 Archived-At: At Tue, 10 Jul 2012 10:51:57 -0400, Eli Barzilay wrote: > 20 minutes ago, Marijn wrote: > > > > It seems to me that both these results cannot be correct > > simultaneously, but I'll await the experts' opinion on that. > > This does look weird: > > #lang racket > (define-for-syntax (f stx) #`(let ([x 1]) #,stx)) > (define-syntax (m stx) > (with-syntax ([zz (f #'x)]) #`(let ([x 2]) zz))) > (m) > > evaluates to 1, but if I change the first two "stx" names into "x" > *or* if I change the argument name for the macro to "x", then it > returns 2. It's natural --- but not correct --- to think that #` is responsible for hygiene, in which case `(f #'x)' should keep the given `x' separate from the `let'-bound `x' in the result. Instead, hygiene is the responsibility of macro invocation, and #`(let ([x 1]) #,#'x) is simply the same as #`(let ([x 1]) x) and so (f #'x) above is equivalent to #`(let ([x 1]) x) If you change the example to #lang racket (begin-for-syntax (define-syntax-rule (f body) #`(let ([x 1]) body))) (define-syntax (m stx) (with-syntax ([zz (f x)]) #`(let ([x 2]) zz))) (m) so that `f' is used as a macro instead of a function, then you get 2, since the macro-expansion of `(f x)' keeps the `x's separate. _________________________ Racket Developers list: http://lists.racket-lang.org/dev