From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: pending branch: lexical-literals Date: Fri, 29 Apr 2011 17:16:32 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1304090218 26721 80.91.229.12 (29 Apr 2011 15:16:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2011 15:16:58 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Apr 29 17:16:49 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QFpQy-0008Ak-Jq for guile-devel@m.gmane.org; Fri, 29 Apr 2011 17:16:44 +0200 Original-Received: from localhost ([::1]:57285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFpQx-0001M7-TL for guile-devel@m.gmane.org; Fri, 29 Apr 2011 11:16:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFpQt-0001LR-P1 for guile-devel@gnu.org; Fri, 29 Apr 2011 11:16:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFpQs-0005Iu-8p for guile-devel@gnu.org; Fri, 29 Apr 2011 11:16:39 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:53243 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFpQr-0005Im-VA for guile-devel@gnu.org; Fri, 29 Apr 2011 11:16:38 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 47DDB4A02 for ; Fri, 29 Apr 2011 11:18:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:mime-version:content-type; s=sasl; bh=o gnJdXcU6SjfyLt73YNe8YwYCH0=; b=UH0hFfubvwS+soRKHXgFzq7x6LEx+iuA/ bgxvjcadQbNz97v8m6lO2sLHFeTTI+UajbYAR2g/TGxSZ8UkedpQoy9WP9s9JAUh edICi+NY54948BVa5ordrxj2rTfAkonUcCYuHWnEccv+wuDcxE967QlQsdWc/9UH pOakTSfG2U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:mime-version:content-type; q=dns; s=sasl; b=Fgs 0ubX1kYQQMzJvqlcSgjDckZ6Pd787bi4gJlANzt+JamffpZM26RNus+eRT+ktRbK bVMjovGZPOfdiuYH8kodXYkR7XMzQgQ63UVVJU47deB7FDlY/LnfkDsSPrfUkwjV TXuE7q9XQI9bD5V+WywD+XI+udMJ1b8Ll+Vwi6MY= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 4382E4A00 for ; Fri, 29 Apr 2011 11:18:39 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id B6C5549FF for ; Fri, 29 Apr 2011 11:18:38 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: F5CFBA30-7273-11E0-9BD8-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12379 Archived-At: Hi all, I have a branch that fixes literal matching to actually compare toplevel bindings, as the RNRS suggest, rather than simply assuming that a literal that is not lexically bound can be compared symbolically. (Recall that literals are things like `else' and `=>' in `cond'.) I send this note because this change increases the coupling between a macro's definition and the definition of the literals that it references. For example, in the past: scheme@(guile-user)> (cond (else #t)) $1 = #t Here the `else' is unbound both in the definition of `cond' and at the use-site, so the literal should match in any case. scheme@(guile-user)> (define else #f) scheme@(guile-user)> (cond (else #t)) $2 = #t Here the `else' is bound at the site of use, but the comparison still succeeded, because `else' was matched by name (symbolically), not by binding (lexically). But now, with this change: scheme@(guile-user)> (cond (else #t)) $1 = #t scheme@(guile-user)> (define else #f) scheme@(guile-user)> (cond (else #t)) scheme@(guile-user)> `else' did not match, because it was a different binding. This case has not changed, however: scheme@(guile-user)> (let ((else #f)) (cond (else #t))) scheme@(guile-user)> So whereas before, including something in a literals list did not specify anything about the toplevel binding, now it does; which increases the coupling between your macro and your literals. For example `eval-when' was depending on the bindings of `eval', `load', `compile', and `expand' at the macro definition and expansion sites. I didn't want this, so I changed eval-when to match symbolically instead -- something that is possible with syntax-case, though not easily facilitated. With that change, Guile recompiled fine, and passed tests. This change allows us to bind keywords, and thereby export them from modules, and have them available for renaming. See http://article.gmane.org/gmane.lisp.scheme.reports/317 for more arguments. I am considering pushing this change to 2.0.x. We will not be binding literals by default in 2.0.x however, as that would be incompatible. I am considering doing that in 2.2, though; dunno. Comments? See the "lexical-literals" branch in git for more. Cheers, Andy -- http://wingolog.org/