unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Evgeny Zajcev <lg.zevlg@gmail.com>
Cc: monnier@iro.umontreal.ca, emacs-devel <emacs-devel@gnu.org>
Subject: RE: file-exists-p on empty string
Date: Wed, 27 Feb 2019 15:23:19 -0800 (PST)	[thread overview]
Message-ID: <923ee6b0-0d19-4dae-bd58-6a576a892ef4@default> (raw)
In-Reply-To: <CAO=W_Zp4w=hsr+du-5gQGe_R9xdLL0K9G7Cr-JFduHBmbDq_0A@mail.gmail.com>

> > > > The problem is that docstrings describe the behavior of a specific
> > > > function, so they usually don't mention the more general aspects that
> > > > affect all functions of a given subsystem, such as here the general
> > > > treatment of the empty string when used as a file name. Otherwise,
> > > > every file-name-manipulating function would have to repeat this
> > >
> > > 
> > > So, maybe FILENAME argument at least could be renamed to NAME to give
> > > at least some hint that this is not a filename, but just a name hint
> > > which will be expanded and canonised to real filename?
> >
> > That's not good enough.  It might make sense
> > to you now, now that you know something about
> > how the input is interpreted as a file name.
> >
> > The parameter name FILENAME is more appropriate
> > than NAME.  But the doc string should say more
> > about it.  You can't rely on just the parameter
> > name to convey all of the meaning that you're
> > (now) reading into it.
>
> But what to do with `file-name-directory` function,
> which returns `nil` to empty string, while
> `file-exists-p` returns `t', and both of them gets
> FILENAME as argument ?

The doc string of each should describe its parameters
and return values.  Formal parameter names are a help,
nothing more.  Sometimes a parameter name is clear
enough that it can be used inline in a sentence in
such a way that the sentence clarifies its meaning
or its name clarifies the sentence.  Sometimes not.

If a parameter name is truly misleading then it should
be changed.  I don't think that's the case here (for
either of the functions you mention).  But others
might have different opinions.

The point is that the doc string should describe the
function: its behavior, its inputs, its return value,
and its side effects.



  reply	other threads:[~2019-02-27 23:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 22:09 file-exists-p on empty string lg.zevlg
2019-02-27 22:23 ` Drew Adams
2019-02-27 22:41   ` Evgeny Zajcev
2019-02-27 23:23     ` Drew Adams [this message]
2019-02-28  0:08       ` Evgeny Zajcev
2019-02-28  1:16     ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2019-02-27 20:07 lg.zevlg
2019-02-27 21:18 ` Stefan Monnier
2019-02-27 22:01   ` Drew Adams
2019-02-28  3:24     ` Stefan Monnier
2019-03-06  9:51   ` Michael Albinus
2019-03-08  6:11     ` Stefan Monnier
2019-03-09  8:48       ` Michael Albinus
2019-02-27 12:29 Evgeny Zajcev
2019-02-27 14:15 ` Michael Albinus
2019-02-27 15:29   ` Troy Hinckley
2019-02-27 15:43   ` Robert Pluim
2019-02-27 16:01     ` Michael Albinus
2019-02-27 16:55       ` Eli Zaretskii
2019-02-27 18:09         ` Michael Albinus
2019-02-27 16:11     ` Eli Zaretskii
2019-02-27 16:16       ` Robert Pluim
2019-02-27 16:30     ` Andreas Schwab
2019-02-27 19:40     ` lg.zevlg
2019-02-27 15:53 ` Stefan Monnier
2019-02-27 16:00   ` Robert Pluim
2019-02-27 16:15     ` Stefan Monnier
2019-02-27 16:09 ` Eli Zaretskii
2019-02-27 18:42   ` lg.zevlg
2019-02-27 18:46     ` Eli Zaretskii
2019-02-27 19:04       ` lg.zevlg
2019-02-27 19:16         ` Eli Zaretskii
2019-02-27 19:29           ` lg.zevlg
2019-02-27 19:30         ` Stefan Monnier

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=923ee6b0-0d19-4dae-bd58-6a576a892ef4@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=lg.zevlg@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).