unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, Philip Kaludercic <philipk@posteo.net>
Cc: "58364@debbugs.gnu.org" <58364@debbugs.gnu.org>
Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p'
Date: Sat, 8 Oct 2022 17:20:57 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488E2DDC3D15BEDAC3594F1F35E9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <83czb2lj79.fsf@gnu.org>

> For apropos, how about changing the doc string to say this instead:
> 
>   Return non-nil if DIR is a parent directory of FILE.
>   Value is non-nil if FILE is inside DIR or inside a subdirectory of
>   DIR.  A directory is considered to be a "parent" of itself.

This is what's wrong with talking loosely about
a file being "inside" a directory - confusion.

The function is called `file-in-directory-p',
where you expect "in" to mean _either_ "inside"
DIR _or_ "inside" a subdir of DIR.  And does
"subdir" here mean a child of DIR or a
descendent of DIR?

Right away, this introduces confusion.  What
does it mean to be "inside" DIR - does it mean
be directly in DIR?  Or does it mean be directly
in either DIR or a directory that's a descendent
of DIR?

If you mean the latter then it makes no sense
to add "or inside a subdirectory of DIR", since
anything "in" any "subdir" of DIR is in that
case also "in" DIR.

And then there's the first doc-string line:

  ...DIR is a parent directory of FILE.

This is wrong.  The predicate apparently tests
whether DIR is an _ancestor_ directory; it
doesn't test whether it's a _parent_ directory.

In some languages "parent" can mean "ancestor"
or even "relative".  But not in English.

And this leaves aside the problem of whether
you really want to say that a _directory_ is a
parent of a _file_.  A dir _contains_ files.
Do you want to also say that a dir is a parent
or ancestor of a file?  (And this has nothing
to do with the fact that a directory itself is
also a file.)

The predicate is about an ancestor-descendent
relation, not a parent-child relation.

And it's really about such a relation between
the directory that FILE is contained in
directly and DIR - that is, it's more precise
not to speak of a directory being a parent or
an ancestor of a file.  (But if you want to
skip over that distinction, that could be OK.)

The predicate name is maybe less important
than getting the doc to be correct.  But
there's really no reason they can't both be 
accurate.

And if Emacs starts using accurate terminology
here then search, completion, apropos etc.
will be more helpful.

And the manual's Index can still offer (also)
entries that are less than accurate, as some
users may well think of a term like "parent"
before they think of "ancestor".  That
possibility isn't a reason not to use more
accurate terms in the doc (in particular), or
even in the function name.

https://en.wikipedia.org/wiki/Ancestor

https://stackoverflow.com/a/10993384/729907

https://stackoverflow.com/questions/55607027/git-what-is-the-logical-difference-between-parent-and-ancestor

https://stackoverflow.com/a/54889445/729907

https://sebastian.expert/ancestor-descendant-sibling-parent-child-explained/

https://teamtreehouse.com/community/what-is-the-difference-between-an-ancestor-and-parent-how-do-ancestors-parents-and-child-elements-relate

https://www.wwp.northeastern.edu/outreach/seminars/_current/presentations/xslt_intro/xpath_intro_tutorial_08.xhtml

https://wp-qa.com/what-is-the-difference-between-current_page_parent-and-current_page_ancestor

https://wikidiff.com/ancestor/parent






      parent reply	other threads:[~2022-10-08 17:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 20:23 bug#58364: [PATCH] Add new function 'file-name-parent-p' Philip Kaludercic
     [not found] ` <handler.58364.B.16651742163752.ack@debbugs.gnu.org>
2022-10-07 20:46   ` bug#58364: Acknowledgement ([PATCH] Add new function 'file-name-parent-p') Philip Kaludercic
2022-10-07 21:10 ` bug#58364: [PATCH] Add new function 'file-name-parent-p' Drew Adams
2022-10-08  6:17 ` Eli Zaretskii
2022-10-08  7:21   ` Philip Kaludercic
2022-10-08  8:01     ` Eli Zaretskii
2022-10-08  9:23       ` Philip Kaludercic
2022-10-08 10:10         ` Eli Zaretskii
2022-10-08 10:29           ` Philip Kaludercic
2022-10-08 11:16             ` Eli Zaretskii
2022-10-08 17:20           ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488E2DDC3D15BEDAC3594F1F35E9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=58364@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).