From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: file-exists-p on empty string Date: Wed, 27 Feb 2019 15:23:19 -0800 (PST) Message-ID: <923ee6b0-0d19-4dae-bd58-6a576a892ef4@default> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="215143"; mail-complaints-to="usenet@blaine.gmane.org" Cc: monnier@iro.umontreal.ca, emacs-devel To: Evgeny Zajcev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 28 00:23:50 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 1gz8YI-000tpY-30 for ged-emacs-devel@m.gmane.org; Thu, 28 Feb 2019 00:23:50 +0100 Original-Received: from localhost ([127.0.0.1]:52111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz8YG-0007Ba-Ro for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 18:23:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz8Y8-0007BH-Sk for emacs-devel@gnu.org; Wed, 27 Feb 2019 18:23:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz8Y7-00067t-Jx for emacs-devel@gnu.org; Wed, 27 Feb 2019 18:23:40 -0500 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:52266) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gz8Y2-0005xk-VX for emacs-devel@gnu.org; Wed, 27 Feb 2019 18:23:38 -0500 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1RNJ7IJ188270; Wed, 27 Feb 2019 23:23:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=oJSiYnmsikbdijXjWpkfPH2wD8iBSaC8Ur+Rp/tFkw4=; b=JpnXpgDvKsrXHD3vEFKuQ8wZaKxFHhT2A3KFPiB8kqDBu6apbUapx8/yEHXRm93E3zOJ uf/MPLKMOLxqmL8qeCF69UqXLsF5ol9XoF1O4Bh+duXVifDrT/qWs56PSabBZAE65cTU aXlNgnkZZtGVliZFjmasc0FYVTBdZQcfrDx2b3B5Sg0U9qFVKWnr1YeWC/bNXnEQQ+6z ooiBGgc3k0i7uYCKyVk/Vpx6JMBaIkSFSwbT9SSArvzPIq598j+nEXu8sxtw/Nwt8lXD +owFI71VcD6EnUqqDw1RHJplMOpUzsGJQW1+ak3poon7kvv0dqKDWEUzhWFIVsP1g7Ts /g== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2qtupee2p9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Feb 2019 23:23:23 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1RNNMhR031596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Feb 2019 23:23:22 GMT Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1RNNKrp022392; Wed, 27 Feb 2019 23:23:22 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4810.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9180 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902270151 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.79 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:233686 Archived-At: > > > > The problem is that docstrings describe the behavior of a specific > > > > function, so they usually don't mention the more general aspects th= at > > > > 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 > > > > > >=20 > > > 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.=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-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.