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: mark uniqueness (Was: Re: syntax-local-binding) Date: Tue, 24 Jan 2012 21:28:50 +0100 Message-ID: <87mx9clu9p.fsf_-_@pobox.com> References: <874nvw99za.fsf@pobox.com> <87zkdo7uf5.fsf@pobox.com> <87sjjbvs12.fsf@pobox.com> <87sjjaunme.fsf@netris.org> <87r4yurruv.fsf@pobox.com> <87obtyuj4k.fsf@netris.org> <871uqqpfoo.fsf@pobox.com> <87hazmrv15.fsf@netris.org> <87zkdem58t.fsf@pobox.com> <87d3a9mjcy.fsf@pobox.com> <874nvls04f.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1327437315 9374 80.91.229.12 (24 Jan 2012 20:35:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 Jan 2012 20:35:15 +0000 (UTC) Cc: Peter TB Brett , guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jan 24 21:35:09 2012 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 1Rpn58-0006dd-4j for guile-devel@m.gmane.org; Tue, 24 Jan 2012 21:35:06 +0100 Original-Received: from localhost ([::1]:60962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpmzH-00054l-Et for guile-devel@m.gmane.org; Tue, 24 Jan 2012 15:29:03 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:55636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpmzD-00053n-Fm for guile-devel@gnu.org; Tue, 24 Jan 2012 15:29:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpmzB-0004E8-Tu for guile-devel@gnu.org; Tue, 24 Jan 2012 15:28:59 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:62023 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpmzB-0004E4-Qo for guile-devel@gnu.org; Tue, 24 Jan 2012 15:28:57 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 01F73802E; Tue, 24 Jan 2012 15:28:56 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=H8hxU8A8WRi0vGzE0jZL/zStgaQ=; b=Ysqu6O wybym9xeJYuX1dPmrYn4xLmkrlYXCQhtQiExYESmXelaM9bR9ixSR+YCDEZpMsv3 SEhQt84XetpVYi8oJbpA2l6ovjFWmDhWhv9hikNRFZJH+HVDkj9upzTU4rxfxPeo tBTKjqF06CDgUOI+EFIWifcw854I5SuO4EWOM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=f6wfi+eK0ZO/rRiYhuO2EPHo/Lm141ZC eXZd8vXkNyYWvRQ2OOvublrF6e2h1PaqcadmtaqAvc4xQrI7XX9FwVi2oG0ZoOp9 hIbPG6vyJ6RWXNYnucyToBcm39iim7l5rPOeNrM/GKZu+AcUKvI9VlrrAJNiDBJ1 iPIwsrr/O8c= 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 EEAC4802D; Tue, 24 Jan 2012 15:28:55 -0500 (EST) Original-Received: from badger (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 0F302802B; Tue, 24 Jan 2012 15:28:54 -0500 (EST) In-Reply-To: <874nvls04f.fsf@netris.org> (Mark H. Weaver's message of "Tue, 24 Jan 2012 08:25:52 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: 09641976-46CA-11E1-87DA-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.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:13662 Archived-At: On Tue 24 Jan 2012 14:25, Mark H Weaver writes: > I don't see why we need universally-unique gensyms > I've already explained why they are not needed > for macros compiled in another session. Ah, I forgot to reply to that. I found it: On Mon 16 Jan 2012 14:28, Mark H Weaver writes: > The reason it has not been a problem with macros is that, within a > top-level macro (which are the only ones used across Guile sessions), > the only syntax-objects that can be meaningfully _introduced_ into the > expansion are top-level/module bindings. But these bindings have no > associated labels or gensyms, because they're not in the wrap. > > See how this is a problem now where it wasn't before? > Or am I missing something? Either you are missing something, or I am, or both of us -- that much is clear ;-) Psyntax associates marks with every identifier. Two identifiers are equal if they are symbolically equal, and they have the same marks. It would break hygiene if two identifiers that didn't come from the same place accidentally had the same marks. A fresh mark is placed on syntax returned from a macro expander, if the syntax was not present in the input. An easy way to do this would be simply: (define-syntax-rule (fresh-identifier) #'x) (define my-id (fresh-identifier)) All you need to do is to introduce that binding into a macro, and you might alias some other binding, because you have serialized the symbol and marks into a compiled file. This is admittedly far-fetched. But it can happen, and at the top-level. For example, our old friend: (define-syntax-rule (define-const x val) (begin (define t val) (define-syntax x (identifier-syntax t)))) Here, `t' will have a fresh mark. Now, if in one compilation unit, I do: (define-const x 10) And in another, I do: (let ((t 20)) x) => ? You would expect the result to be 20. But I think it could be 20, if the marks on the two "t"s happened to collide. Am I missing something? :-) Andy -- http://wingolog.org/