From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Arbitrary function: find the number(s) of expected arguments Date: Sat, 19 Mar 2016 16:30:30 +0000 Message-ID: References: <56E8906C.5050405@lanl.gov> <83egb68vfy.fsf@gnu.org> <87zituefp9.fsf@web.de> <83a8lu8srs.fsf@gnu.org> <87twk2ebp2.fsf@web.de> <838u1e8od1.fsf@gnu.org> <8360wi8mbo.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114014945877b9052e6962eb X-Trace: ger.gmane.org 1458405066 25176 80.91.229.3 (19 Mar 2016 16:31:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2016 16:31:06 +0000 (UTC) Cc: michael_heerdegen@web.de, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 19 17:31:00 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 1ahJmG-0007jJ-AJ for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2016 17:31:00 +0100 Original-Received: from localhost ([::1]:49609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahJmF-0007Fc-ME for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2016 12:30:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahJly-0007FT-3b for emacs-devel@gnu.org; Sat, 19 Mar 2016 12:30:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahJlx-0000oh-0O for emacs-devel@gnu.org; Sat, 19 Mar 2016 12:30:41 -0400 Original-Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:36630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahJlw-0000od-Md; Sat, 19 Mar 2016 12:30:40 -0400 Original-Received: by mail-lf0-x22d.google.com with SMTP id d82so37822999lfe.3; Sat, 19 Mar 2016 09:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SHOow9B93HBLzSeyWCdhRd7ufZ081lf1FPo2H0bjclo=; b=tF/2kEb+IblWdR/7WuKuS2BWzyhNB80Tz64wu3kWxqo1v+0FKafnUhe+WRJCwRkYN5 dTRuvhiTQAa0cMZCcqSEAyojgV5xvJNqkyKxzHmpbUGxi0YUoJ2+lnGVDPFkucRd876b r2s0jPpEpyD7V/3+9i6toPLuT7kLVyEl4uisY/khjwGn7TZTZnvMXo6bofjDgEcEkyIK X+FJHWKX5T0LCnp6Bd/vFI+tYws4GlRFo/Rc81BN2HceFBsy9m18kHg+JpSUltmB7htu ftIgEXCLrN7z98JYtH46sL6T1Q0RBIuWIICNPQTSCCDB86PstkeqMan43yrjSI5/0jM8 iF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SHOow9B93HBLzSeyWCdhRd7ufZ081lf1FPo2H0bjclo=; b=DOH6PYZ9rjvPNkEb4+t+IYdmBKsYarNWMYhkjFkKSKtiCL2BdsgKBUFr626Mca28om c8yzSSnNv8yUe6J5SRW9zVT4LbddCRMGksrb4LS0VDRivCDheU0n2fo1RCdfjYGm6+q7 88hUHyTt911SKXumegfQoqLR6UmYCUxeuaP/IkmFxWIIddagpz2lQLHfQiiuYUU2CHp6 YOX0cohK6qNQqRQY8GuwutTgHhsaPyMYcoTKf6j6bYoj2u1DgI5UCjwsJugMaTiVniX6 fifoWcP3pW4c7wCEz05Iv9tPPgWmCn1m2nDL6idEw9SPgh52Rihsc+U6v5EAeoU1bnLH dtew== X-Gm-Message-State: AD7BkJLOpPR0AtHZsefjMptT99lRNvioZMpI/LnWbI2yau9/gvKqU60fCH/0bRRL+Tul9OK/8rIRvAW1/H3//w== X-Received: by 10.25.148.71 with SMTP id w68mr5988174lfd.23.1458405039959; Sat, 19 Mar 2016 09:30:39 -0700 (PDT) In-Reply-To: <8360wi8mbo.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22d 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:201877 Archived-At: --001a114014945877b9052e6962eb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii schrieb am Sa., 19. M=C3=A4rz 2016 um 17:28 Uh= r: > > From: Philipp Stephani > > Date: Sat, 19 Mar 2016 16:14:04 +0000 > > Cc: emacs-devel@gnu.org > > > > Knowing the arity in cases like this requires either evaluating the > function, or complex parsing of its definition. > > What do you mean by "complex parsing"? Did you look at how the Lisp > interpreter does that? > Yes, but parsing the arglist. But the arglist of g is (&rest args). > > > It is very reasonable to assume that (func-arity 'g) would return (0 . > many), because that is g's arity as far as > > the Lisp interpreter is concerned. > > No, that's not g's arity: > > (g 10 202 30) =3D> error -> "Wrong number of arguments" > This cannot be detected without evaluating the function. --001a114014945877b9052e6962eb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Sa., 19. M=C3=A4rz 2016 um 17:28=C2=A0Uhr:
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 19 Mar 2016 16:14:04 +0000
> Cc: emacs-dev= el@gnu.org
>
> Knowing the arity in cases like this requires either evaluating the fu= nction, or complex parsing of its definition.

What do you mean by "complex parsing"?=C2=A0 Did you look at how = the Lisp
interpreter does that?

Yes, but parsing= the arglist. But the arglist of g is (&rest args).
=C2=A0

> It is very reasonable to assume that (func-arity 'g) would return = (0 . many), because that is g's arity as far as
> the Lisp interpreter is concerned.

No, that's not g's arity:

=C2=A0 (g 10 202 30) =3D> error -> "Wrong number of arguments&qu= ot;

This cannot be detected without eva= luating the function.=C2=A0
--001a114014945877b9052e6962eb--