From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Evgeny Zajcev Newsgroups: gmane.emacs.devel Subject: Re: file-exists-p on empty string Date: Thu, 28 Feb 2019 01:41:33 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000db51430582e7e026" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="35230"; mail-complaints-to="usenet@blaine.gmane.org" Cc: monnier@iro.umontreal.ca, emacs-devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 23:42:00 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz7to-000923-9n for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 23:42:00 +0100 Original-Received: from localhost ([127.0.0.1]:51641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz7tn-00015P-6e for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 17:41:59 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz7td-000157-0k for emacs-devel@gnu.org; Wed, 27 Feb 2019 17:41:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz7tb-0002SL-NQ for emacs-devel@gnu.org; Wed, 27 Feb 2019 17:41:48 -0500 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:44468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gz7tb-0002Qy-8m for emacs-devel@gnu.org; Wed, 27 Feb 2019 17:41:47 -0500 Original-Received: by mail-lj1-x229.google.com with SMTP id q128so15334532ljb.11 for ; Wed, 27 Feb 2019 14:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MoJ9Z80iObJHUHWQwte01aMBLr4/qEGzEWNgsMjaJLU=; b=fOZLfhpfz5dd9lbS4vIhI+B4LD5ipuUgG4by2a8PlSGj17wdY584QUANINKPPi9EXl b01DQbZTSy+BpcfyYxZRcypitH5EbatenIBjoTXyTY29ewCw3WilTSoYF5QGFUtUymcV 0lNadTD1MQgcn68UXCSqsPDHGLl7O4qoTMWVc3wNq/4lEkYqB89h3bZtZrCJ+R+kqAwL Q7kMGeJYiRMrc+2f9Zw3rx/r5+XnIt4AQxZDg0+yftlId8pSS9fJQGzEixOHC1WkGVW1 TcCtLGKRRQOFRGpfr+9wqehvWEr47QSkaNpCUeJAEvBHgNXBWJDVFpb9SdUCRcjYXeFH 01Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MoJ9Z80iObJHUHWQwte01aMBLr4/qEGzEWNgsMjaJLU=; b=oDMg2C7gIXXqFUUgyB2ay6JmmjXR19QBVj7iENBgoJHPJhBjFeqdPXhBuicYkpHJVr SXhP39O6DGLzhogZljqzfllE2+r/MgmENl+otiI8LGi0zUp8C51nhX7R0GrgvJ/Rhsqd YXH1i8fQWi6xq8fkdx3BmF27EJ2ddCwMLVnjoww80OW9N3VN/6O/IZwD4I8JXn6J+Sfu BTeWHTtCrUW/9TPpmd2NbAaICvOr4K2tgw6b94k9rF26qLMPbhal7Q+ogz9T1yq3pnJu wd2j8l3fOB68MGcj9iZsHm6JBK/+D9HuGw0KfgzWW+ZZuup8XPOf6coC4HtG19GGsWNq 6tQw== X-Gm-Message-State: AHQUAubt1GaWqnWEdRdXj8cAxGkTVJcj6vNud09hmS+8TyMRSjLKO7pS oZMLXez9YJQjBWeuERTGCctxds3NfIg3+JAQx1I= X-Google-Smtp-Source: APXvYqxgH+8di0x6l381U+rKcKr6ohotteqwLZ87xUImmG8HKJxqn03ejmzg0dZgo3/HRvf4943ABNuRvhlzhwK8f8w= X-Received: by 2002:a2e:9916:: with SMTP id v22mr2744944lji.68.1551307305077; Wed, 27 Feb 2019 14:41:45 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233684 Archived-At: --000000000000db51430582e7e026 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D1=87=D1=82, 28 =D1=84=D0=B5=D0=B2=D1=80. 2019 =D0=B3. =D0=B2 01:24, Drew = Adams : > > > 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 > > information in its docstring. > > > > 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 ? --=20 lg --000000000000db51430582e7e026 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=D1=87=D1=82, 28 =D1=84=D0=B5=D0= =B2=D1=80. 2019 =D0=B3. =D0=B2 01:24, Drew Adams <drew.adams@oracle.com>:
> > The problem is that docstrings = describe the behavior of a specific
> function, so they usually don't mention the more general aspects t= hat
> 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
> information in its docstring.
>
> So, maybe FILENAME argument at least could be renamed to NAME to give<= br> > 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.=C2=A0 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.=C2=A0 But the doc string should say more
about it.=C2=A0 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-n= ame-directory` function, which returns `nil` to empty string, while `file-e= xists-p` returns `t', and both of them gets FILENAME as argument ?
<= /div>

--
lg
--000000000000db51430582e7e026--