emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only direct


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only directory names
Date: Tue, 27 Oct 2015 09:59:43 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> So you live dangerously if you forget the trailing slash in
>> default-directory, but you live dangerously if you do add it in
>> load-path?
> Yes, that's what the current implementation provides. I agree it's not
> consistent (apparently XEmacs is more consistent here).

If we really want to be anal-retentive, then at the very least we should
be consistent.

>> What's the benefit of this pickiness?
> When you are writing code that iterates thru load-path, using the
> entries for various things (checking that they exist, listing contents),
> it helps to know how they are defined.

I too can come up with hypothetical benefits: my question was about
*concrete* benefits.

>> Unless there's a real performance advantage (which I fail to see), 
> The only performance advantage so far is the difference between:
> (expand-file-name file dir)
> ;; full defensive programming
> (concat dir file)
> ;; assuming the doc string is right, and/or has been verified at a
> ;; higher level

I see 10 characters saved above.  Doesn't sound like a real performance
advantage [ yes, I know you were referring to another kind of
performance, but without real-world measurements this has no meaning.  ]

> which is not likely to be significant in code that is reading the actual
> disk (that will be the slow part).

So, it seems we agree that there is no performance advantage.

> You can't "fix" default-directory; you could change its definition, but
> then you would have to fix (or at least verify)_every_ use of it, which
> is impossible, since it could be used in everyone's private code.

My gut feeling is that the risk of introducing a bug when changing
process.c's handling of default-directory is lower than the probability
of fixing latent bugs.

> We are changing the doc string of load-path, but only because it was
> inconsistent with the actual implementation in core. It is now consistent.

No, it was not inconsistent.  "directory name" is used all over the
place to mean "with or without trailing slash, it doesn't matter", so
the original doc-string was fine.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]