From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#40968: 28.0.50; (apply nil) Date: Wed, 6 May 2020 14:35:41 -0700 (PDT) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="15297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , 40968@debbugs.gnu.org To: Phil Sainty , Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 06 23:38:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWRk4-0003t7-AF for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 May 2020 23:38:12 +0200 Original-Received: from localhost ([::1]:36452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWRk3-0002Dg-Ar for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 May 2020 17:38:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWRju-0002As-KA for bug-gnu-emacs@gnu.org; Wed, 06 May 2020 17:38:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWRju-0002u7-9c for bug-gnu-emacs@gnu.org; Wed, 06 May 2020 17:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jWRju-00052G-75 for bug-gnu-emacs@gnu.org; Wed, 06 May 2020 17:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 May 2020 21:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40968 X-GNU-PR-Package: emacs Original-Received: via spool by 40968-submit@debbugs.gnu.org id=B40968.158880107119335 (code B ref 40968); Wed, 06 May 2020 21:38:02 +0000 Original-Received: (at 40968) by debbugs.gnu.org; 6 May 2020 21:37:51 +0000 Original-Received: from localhost ([127.0.0.1]:41474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWRji-00051n-W0 for submit@debbugs.gnu.org; Wed, 06 May 2020 17:37:51 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:56470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWRji-00051a-35 for 40968@debbugs.gnu.org; Wed, 06 May 2020 17:37:50 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 046LbeOX117620; Wed, 6 May 2020 21:37:44 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-2020-01-29; bh=FOcHwtPYhfqq9pfza+O335y72pva6CJmJDbzDo3M8d0=; b=OWvUQuCW4ztKLWMDOb96u7xSoGoAYyyTcSGzMhvughR+fSCMsi8e9HLOZDgMsaHznVll HVtMwgjByt55oW0mLnVZC4IGiuuUFYLP+/0iISXH1jH2NcSYovY35ZYCpBRPLoxRD7G6 gNrpYIsCU1f6vpn4VCSSev1gpH7B8AYM45mQlr0ofk0phvRjkwez3x+xopC2nfv8j8xl 3hW/upFVwvl9zftmHhX7zMZhER8ROYZk1OFGpmc7H2IDHVzQEyMzh4BDSfafEVSAajtx kGULApLAhWuvR7mZBZVkE6N8eiVkYpZZCpmb/oK8Y0DeFCrVMTwUl9hL1xcaAjju5jEz Yw== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 30s09rcwrh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 May 2020 21:37:44 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 046LZckx072738; Wed, 6 May 2020 21:35:43 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 30sjnksex3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 May 2020 21:35:43 +0000 Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 046LZgjT018106; Wed, 6 May 2020 21:35:42 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4993.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9613 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 phishscore=0 mlxlogscore=966 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005060172 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9613 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 clxscore=1011 suspectscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005060173 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179847 Archived-At: > To my mind the nicest change would be to handle the two error cases, > and keep everything else the same. >=20 > 1. (apply nil) would signal an error. > 2. (apply FUNC) would be equivalent to funcall, rather than signalling > an error, when (functionp FUNC) -- or perhaps just (not (consp > FUNC)). > 3. (apply LIST) would remain equivalent to (apply (car LIST) (cdr > LIST)) >=20 > I don't feel strongly about #2. It seems like a nice enhancement to > me, > but if others feel that would be cause problems then I wouldn't argue. > Existing uses of that in the wild are obviously signalling errors at > present, so offhand it doesn't seem to me like a dangerous change, and > it would match the existing signature. >=20 > #3 just seems like the only useful thing that apply could possibly do > with a single list argument, so I'd definitely keep that. >=20 > #2 and #3 are surely both convenient for generated code which doesn't > know how many arguments it's going to be dealing with. >=20 > I would still use (FUNCTION &optional ARGS) as the signature, and just > document what happens when FUNCTION is actually a list. What's wrong with doing what Common Lisp does (apparently, per the doc'd signature)? (apply FUNCTION first-arg &rest other-args) The first arg to `apply' is required, and must be a function. The second arg to `apply' is required. Any arg after the second is optional. The last arg to `apply' must be a list. (This is true even if it is the second arg.) It can be nil. * If the last arg is the second arg, then its elements are the args passed to FUNCTION. (If it is the empty list then FUNCTION must be nullary.) * If the last arg is not the second arg, then its elements are the Nth args for FUNCTION, where N =3D 1+ the element index. FUNCTION must be able to accept M args, where M =3D 1+ the number of elements in the last arg. "Must" means an error is raised if not so. (apply) =3D> error (apply ANYTHING) =3D> error (apply FUNCTION '(x) ) =3D> (funcall FUNCTION x) ; last arg: singleton list of args (apply FUNCTION x ()) =3D> (funcall FUNCTION x) ; first arg: x ; last arg: empty list of other args (apply FUNCTION () ) =3D> (funcall FUNCTION) ; last arg: empty list of args (apply FUNCTION () ()) =3D> (funcall FUNCTION nil) ; first arg nil ; last arg: empty list of other args