From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: Modules Date: Sun, 13 Feb 2011 20:05:16 +0100 Message-ID: References: <20101208124502.5f25b64d@halmanfloyd> <20110129131315.506f1e8c@halmanfloyd> <87tygrcnbf.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297623653 16509 80.91.229.12 (13 Feb 2011 19:00:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Feb 2011 19:00:53 +0000 (UTC) Cc: guile-user@gnu.org To: Neil Jerram Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Feb 13 20:00:49 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PohBf-0008W2-FX for guile-user@m.gmane.org; Sun, 13 Feb 2011 20:00:47 +0100 Original-Received: from localhost ([127.0.0.1]:53762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PohBe-0003dp-CO for guile-user@m.gmane.org; Sun, 13 Feb 2011 14:00:46 -0500 Original-Received: from [140.186.70.92] (port=35176 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PohBZ-0003cM-OR for guile-user@gnu.org; Sun, 13 Feb 2011 14:00:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PohBY-00025C-G3 for guile-user@gnu.org; Sun, 13 Feb 2011 14:00:41 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:48016 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PohBY-0001sc-Av; Sun, 13 Feb 2011 14:00:40 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 21E4F4756; Sun, 13 Feb 2011 14:01:19 -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=CJdvgp1D1i36u1yoebBC7uUfevc=; b=Nfz1Cp dUbtgz7Cx/TNqT9NANVPb2fxteD/vNi5+IRdvAAjXCwqd1fgrqD+dXGWt4TyL2f0 Iy0f3Oah15wS2lm0mX5dC77xdDz3IQgryGQKp4rcOTSts2nW7dKSU0IW0/B88y0F AnW4zslQNOmeQxavK+T59RBik4Q2Sdu9DWQs0= 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=A3wFMKStX7ss3FoUXa5kyk6G3zPlsNHJ oQN7jL9OWjVhCcK6DNb407fu80eJnQ3ed4467BxImGAFSHQdjiD0fBM+BFY7KYGC VNe9CuyoDenBcnaPQnZVn7wgYrAbeOQZoIf7YnYv4Tce6cSOTQBn85x47OzO6lNv 4PHtIgN84R8= 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 0020C4754; Sun, 13 Feb 2011 14:01:16 -0500 (EST) 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 07B744753; Sun, 13 Feb 2011 14:01:13 -0500 (EST) In-Reply-To: (Andy Wingo's message of "Sun, 30 Jan 2011 12:42:07 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: A2ADE74C-37A3-11E0-BCCF-AF401E47CF6F-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-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8435 Archived-At: Hello list, A couple weeks ago I wrote about figuring out relative paths for `load' in 1.9: On Sun 30 Jan 2011 12:42, Andy Wingo writes: > it's not clear what to do, exactly, when > you have compiled files; you could not have the corresponding .scm at > all, or in any case when you've loaded the .go you don't actually have a > port to the .scm, and in fact if the file was loaded via > `load-from-path' you don't know exactly where the .scm is at all. > > Perhaps we should residualize into the .go whether the file was compiled > for `load' or for `load-from-path', and what was the original path of > the file. It turns out we already have this information on the Scheme level, in the form of source properties of the expressions. Macros have access to this via `syntax-source'. Also, with "relative" filename canonicalization, the `filename' property of a syntax source will be a relative path if it was found in the load path, and an absolute path otherwise. So, I ended up reimplementing `load' as a macro (!) that expands out to a call to `load-in-vicinity'. Relative paths are looked up against the dirname of the file being expanded. If the dirname is relative, then load-from-path is used, and otherwise load is used. A bare reference to `load' returns a closure that will invoke `load-in-vicinity' with an appropriate vicinity. Hopefully this fully fixes bug 30480, discussed in http://thread.gmane.org/gmane.lisp.guile.bugs/4359, and *part* of this use case. We still need an (add-to-load-path "."), as discussed in a previous mail, to allow use-modules for uninstalled modules to work reliably. Cheers, Andy -- http://wingolog.org/