From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rocky Bernstein Newsgroups: gmane.emacs.devel Subject: Re: relative load-file Date: Sun, 15 Nov 2009 18:50:16 -0500 Message-ID: <6cd6de210911151550v6f66c1begdbcda315f6f8edf5@mail.gmail.com> References: <6cd6de210911110901v24307163i253e69e89c72c9e@mail.gmail.com> <6cd6de210911140744t75b84417udfa6921cc8fe424f@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001636d34bfe0b54e40478718e84 X-Trace: ger.gmane.org 1258329038 3711 80.91.229.12 (15 Nov 2009 23:50:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Nov 2009 23:50:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 16 00:50:31 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N9orW-0003zW-98 for ged-emacs-devel@m.gmane.org; Mon, 16 Nov 2009 00:50:30 +0100 Original-Received: from localhost ([127.0.0.1]:35232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N9orV-00022E-NX for ged-emacs-devel@m.gmane.org; Sun, 15 Nov 2009 18:50:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N9orQ-000229-M6 for emacs-devel@gnu.org; Sun, 15 Nov 2009 18:50:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N9orM-00021h-SM for emacs-devel@gnu.org; Sun, 15 Nov 2009 18:50:24 -0500 Original-Received: from [199.232.76.173] (port=54814 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N9orM-00021e-Pp for emacs-devel@gnu.org; Sun, 15 Nov 2009 18:50:20 -0500 Original-Received: from mail-pw0-f47.google.com ([209.85.160.47]:45183) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N9orK-0001N8-CY; Sun, 15 Nov 2009 18:50:18 -0500 Original-Received: by pwi9 with SMTP id 9so3178339pwi.26 for ; Sun, 15 Nov 2009 15:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=riPCN9iyAxd9sDx2Ct4yMN07N4u0esoCbfVV9DTs71M=; b=We0uVZwZ9dZG/uZUxBiLGC0OLw5Bl7WXasi/ua9yMC8WgJV6UfBtMZXWSuPAs4MYlB vd4/Z40gVk2wWQckl2y1S4r6nzjPrZ4UFqGDvNumbGZApUmRQz8V+BoZ2BBHynEpDlzm so+wNpbNrZD/nDWaPwYlqoyFMJkcr9MisMBzk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=f3mdvVc2NBjxsDe8vkIj2TnIXrUiEYtMs3NIe8NYA78uicFmKJMAT3UQYEQrUvZe3h tnkbktsutJtdtGnSaS2Zp5XXaoX98Afh0vZmrV84t3Vgusp753favGiHssj13jC7DHcd k9foosSdzNG5qSiOqTIodoG1hO3vKphditj98= Original-Received: by 10.142.74.19 with SMTP id w19mr760888wfa.196.1258329016587; Sun, 15 Nov 2009 15:50:16 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 4dab05d8f2bdd7b8 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:117023 Archived-At: --001636d34bfe0b54e40478718e84 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Nov 15, 2009 at 5:38 PM, Richard Stallman wrote: > So what require-relative and load-relative allow one to do is create > these > little independent units without the overhead of using a more elaborate > packaging systems. > > I do not follow your point. I think I understand what you mean by a > program with subparts. Can you explain why you think > `require-relative' is particularly helpful for that? > Particularly helpful? Let's just go with helpful. ;-) require-relative allows me to load or eval and test any one of the subparts without mucking with the load path yet ensure I am getting the right files loaded. One can do something similar by saving, modifying and restoring load-path. I've done that in many languages for many years. And after all these years it is still clumsy, cumbersome, and fragile. (In require-relative, after the check for a feature, if the feature is loaded an additional check can be done to see if the source location is the same as the location requested) Others have noticed issues with path-searching mechanisms; so programming languages like Ruby, Scala, and Python have been moving in the direction of a something like require-relative even though they've long had something like load-path. > That's in fact what I have done< > http://github.com/rocky/emacs-load-relative>. > The only "primitive" needed is Ruby's __FILE__ which is the same thing > as > the C preprocessor __FILE__. > > Why do you think that making it relative to the location of the loading > file is particularly necessary? > > Again let's drop the "particularly" part. No doubt there are many ways to do things and I don't represent that this is the only to work. Possibly not the best way either, although I think an improvement for me over what I've seen codified so far. When I create source code, I very well know what the relative directory/file structure looks like. So when I want to load or require another module, using the relative name is petty simple, straightforward, and clear. Irrelevant is what the load-path or current directory might be is set to at run-time. The only information Emacs needs to fill in is the directory of the source code. That said, I suspect there are other situations that a macro-expanded __FILE__ would be useful. --001636d34bfe0b54e40478718e84 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


=A0 =A0That's in fact what I have done<
http://github.com/rocky/emacs= -load-relative>.
=A0 =A0The only "primitive" needed is Ruby'= ;s __FILE__ =A0which is the same thing as
=A0 =A0the C preprocessor =A0__FILE__.

Why do you think that making it relative to the location of the loadi= ng
file is particularly necessary?


Again let's drop the "particularly"= part. No doubt there are many ways to do things and I don't represent = that this is the only to work. Possibly not the best way either, although I= think an improvement for me over what I've seen codified so far.

When I create source code, I very well know what the relative directory= /file structure looks like. So when I want to load or require another modul= e, using the relative name is petty simple, straightforward, and clear. Irr= elevant is what the load-path or current directory might be is set to at ru= n-time. The only information Emacs needs to fill in is the directory of the= source code.

That said, I suspect there are other situations that a macro-expanded _= _FILE__ would be useful.

--001636d34bfe0b54e40478718e84--