From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.devel Subject: Re: Arbitrary function: find the number(s) of expected arguments Date: Sat, 19 Mar 2016 13:26:47 +0100 Message-ID: References: <56E8906C.5050405@lanl.gov> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113d3c30296fca052e65faa8 X-Trace: ger.gmane.org 1458390428 6000 80.91.229.3 (19 Mar 2016 12:27:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2016 12:27:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Davis Herring Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 19 13:27:07 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ahFyF-0006Do-2a for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2016 13:27:07 +0100 Original-Received: from localhost ([::1]:48665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahFyB-00040g-8R for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2016 08:27:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahFxx-0003zV-0e for emacs-devel@gnu.org; Sat, 19 Mar 2016 08:26:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahFxw-0003a0-6x for emacs-devel@gnu.org; Sat, 19 Mar 2016 08:26:48 -0400 Original-Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:33822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahFxw-0003Zu-0r for emacs-devel@gnu.org; Sat, 19 Mar 2016 08:26:48 -0400 Original-Received: by mail-oi0-x230.google.com with SMTP id l76so19075480oig.1 for ; Sat, 19 Mar 2016 05:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=31DIHjfVeqFuTkT78c+Po4v5ePqXvms3HME/z4hqE2g=; b=x0g1B50Tdh0EjwX5V00Y+ViL9YkaxroV9L49/zFp2wowmwo3Qegv0vKVCeN65DyEwY r7kTDlNWU2N+D78UxHPFjXOmQNkiL1Qrs0eJ9bqFHxvlWnMRddvc9+2ypyHtEFyaEvjz Z5YDTFo89casjEiTPnp8XXdSSf6UFlRCYGF1HLoXOHBaClEihoBTN3WzRbd1y+FTvJwE jMJfK71HyanmNG6aIXLTwIJ8zmPTB0j6ICjpkJMtVjahw9uev5jYQQj2s7DN37EWQD5N w4PkXIUqTy4mqYNOyMMV8wGc4EgD82TqAx6jn09VLShJDjl+9Ud3Eha5/p4um5BkHs6K tjSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=31DIHjfVeqFuTkT78c+Po4v5ePqXvms3HME/z4hqE2g=; b=RGMLj8RthOvRCGBWnpklOB4A8vAsr3r/BzhzaZ07Rk3bU0/CaVCImojZBtkciiDGOf lvLp1HchkjYtn1S1Q1huq2PBdgUiDeQCgyX3PuvItt9aT7HVSI5YqdKqOLCnVv+P0WEF 9+yXvTMMDF/SBmxbF/5M3nJ3h06To5W3YJ2xw3RClJqg/qPOY2d2oYGUSh3lr6vYfgRr mr3jJY3xWwYXB/fO7jY0iU4M/8yv8W2PbVg3rZe7SaG2imOp5GDpSm5t6Q3gp7IkBJya d9kWiwbCjQskBy9t3a72xQjfNYxiHosl6DErfQmG9rRs8Frq5CzPk8WmI2bzpuhVLZk2 H+KQ== X-Gm-Message-State: AD7BkJKyphFko/RuIkeAyspBYWA+pLO7ia/9PYtcWlDzv8KJ0knN7JOXxZJNicrSdeMNQvwX30erMMGmFbCKAA== X-Received: by 10.202.215.86 with SMTP id o83mr12439190oig.55.1458390407144; Sat, 19 Mar 2016 05:26:47 -0700 (PDT) Original-Received: by 10.202.71.7 with HTTP; Sat, 19 Mar 2016 05:26:47 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201860 Archived-At: --001a113d3c30296fca052e65faa8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Let's also consider it like this: `subr-arity' exists. But it has extremely narrow and non-obvious field of use. Compare: (subr-arity (symbol-function 'car)) =3D> (1 . 1) (subr-arity (symbol-function 'caar)) =3D> eval: Wrong type argument: subrp, #[257 "=C2=89@@=C2=87" [] 2 2409164] And to make it even weirder (from `dash.el'): (defalias '-first-item 'car "Return the first item of LIST, or nil on an empty list.") (subr-arity (symbol-function '-first-item)) =3D> (wrong-type-argument subrp car) What if I use `subr-arity' for whatever reason in a case where it works, but in the next version Emacs moves the function from `.c' to `.el' and it ceases to be a built-in? Paul =E2=80=8B --001a113d3c30296fca052e65faa8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Let's also consider it like this: `subr-arity' exi= sts. But it has extremely narrow and non-obvious field of use. Compare:
=C2=A0 =C2=A0=C2=A0(subr-arity (symbol-function 'car)) = =C2=A0=3D> =C2=A0(1 . 1)
=C2=A0 =C2=A0 (subr-arity (symbol-fun= ction 'caar)) =C2=A0=3D> =C2=A0eval: Wrong type argument: subrp, #[2= 57 "=C2=89@@=C2=87" [] 2 2409164]

And to= make it even weirder (from `dash.el'):

=C2=A0= =C2=A0 (defalias '-first-item 'car
=C2=A0 =C2=A0 =C2=A0 = "Return the first item of LIST, or nil on an empty list.")
<= div>
=C2=A0 =C2=A0=C2=A0(subr-arity (symbol-function '-fi= rst-item)) =C2=A0=3D> =C2=A0(wrong-type-argument subrp car)
What if I use `subr-arity' for whatever reason in a case w= here it works, but in the next version Emacs moves the function from `.c= 9; to `.el' and it ceases to be a built-in?

Pa= ul
=E2=80=8B --001a113d3c30296fca052e65faa8--