GNU bug report logs - #29786
27.0.50; About the argument list of methods

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Michael Heerdegen <michael_heerdegen@HIDDEN>; dated Wed, 20 Dec 2017 12:39:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 29786 <at> debbugs.gnu.org:


Received: (at 29786) by debbugs.gnu.org; 27 Dec 2017 14:53:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 27 09:53:04 2017
Received: from localhost ([127.0.0.1]:53242 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eUD4o-0005iP-0G
	for submit <at> debbugs.gnu.org; Wed, 27 Dec 2017 09:53:04 -0500
Received: from chene.dit.umontreal.ca ([132.204.246.20]:35757)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1eUD4m-0005iA-8a
 for 29786 <at> debbugs.gnu.org; Wed, 27 Dec 2017 09:53:01 -0500
Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vBREqvuF020250;
 Wed, 27 Dec 2017 09:52:58 -0500
Received: by ceviche.home (Postfix, from userid 20848)
 id 3E3CF66326; Wed, 27 Dec 2017 09:52:52 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#29786: 27.0.50; About the argument list of methods
Message-ID: <jwvd130fcrp.fsf-monnier+emacs@HIDDEN>
References: <87d139a81c.fsf@HIDDEN>
 <jwvy3lo3o4z.fsf-monnier+bug#29786@HIDDEN> <87lghocq1o.fsf@HIDDEN>
Date: Wed, 27 Dec 2017 09:52:52 -0500
In-Reply-To: <87lghocq1o.fsf@HIDDEN> (Michael Heerdegen's message of "Wed, 27
 Dec 2017 13:29:23 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV6188=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6188> : inlines <6288> : streams
 <1774325> : uri <2558287>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 29786
Cc: 29786 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

>> > (cl-defmethod seq-mapn (function (stream stream) &rest streams)
[...]
>> > \(fn FUNCTION STREAMS...)"
>> I think this "\(fn FUNCTION STREAMS...)" thingy doesn't make sense for
>> `cl-defmethod`: it only makes sense for `cl-defgeneric`.
> But it does make sense in this example, no?

Not really, no: in the docstring of `seq-mapn` what we want to show to
the user about the above method is when it applies, i.e. its
"specializers".  We could try to make it say that the specializer is
"all args after `function` are of type `stream`", but there's no
standard format to express that.  We could invent one, like

    (seq-mapn FUNCTION &rest (STREAMS (list stream)))
or
    (seq-mapn FUNCTION (STREAM stream) ...)

but it seems like more trouble than it's worth.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29786; Package emacs. Full text available.

Message received at 29786 <at> debbugs.gnu.org:


Received: (at 29786) by debbugs.gnu.org; 27 Dec 2017 12:29:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 27 07:29:39 2017
Received: from localhost ([127.0.0.1]:53183 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eUAq3-0000Lf-Jh
	for submit <at> debbugs.gnu.org; Wed, 27 Dec 2017 07:29:39 -0500
Received: from mout.web.de ([212.227.17.12]:51697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1eUAq1-0000LN-DC
 for 29786 <at> debbugs.gnu.org; Wed, 27 Dec 2017 07:29:38 -0500
Received: from drachen.dragon ([88.74.120.211]) by smtp.web.de (mrweb102
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LsQPU-1ewkMn22OW-011wsl; Wed, 27
 Dec 2017 13:29:25 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#29786: 27.0.50; About the argument list of methods
References: <87d139a81c.fsf@HIDDEN> <jwvy3lo3o4z.fsf-monnier+bug#29786@HIDDEN>
Date: Wed, 27 Dec 2017 13:29:23 +0100
In-Reply-To: <jwvy3lo3o4z.fsf-monnier+bug#29786@HIDDEN> (Stefan Monnier's
 message of "Tue, 26 Dec 2017 22:01:29 -0500")
Message-ID: <87lghocq1o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:VHW5JD3Djv9XsMm88PTA7n9l/GphchgbkqJK/gGd2WIprswc2qq
 +1gvhPRVM2TY/D2Lt/S93PdTWvt6HG5Tu6nCoei+zVhN6LrCi4ENTaWGR0G9Xk9jsyTfZU+
 olH1Ih07f3Q9OBeZgnMwBO1doVZuTjvBIj5YkidKc5uwroFooxOQ1t7r++AO2Bx3ihlNYJJ
 Ij+733kO7UcgZ6GBRZcDw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:JueREx6e4W0=:+UQJoPiViKE+G1d7j0YgjQ
 F3Znb9B3WCWrcvyxOkfIFiHxetSs92M5cMuECgnC52hSAdBGnmO1ZUEdQioCLQON8p/WYEnEi
 zRmXoLkh9bZ1EXrL7uYh8n0KdZxDCs+OdgRx3uLyPOfaw64DCoZGRbl+2A26ypnTpM0YpaddD
 qgVdU25FdHMKJzgwtvCUNXMzz7e2b2BUpfEXXBdE5XtDWX2ERB8qvJw6jhR+wO3tP2ocEnN0C
 PS0b3Tyeq06olH9M80djosXneRmXoUPhe3pQYxiXLhkUbNt2/1euyjfp3tNsCyjG7Mo6If+eS
 75os6+P+NivLeNQkGKS9TsA7bvDk0nf509zYamzoNaeNFBsYZfQo9KqS3vDVhOXpBGiFJsUcT
 EqvhBvTOwihyTlpbTnoQvC2uR2M299JhzRU2aLtothXRXMoPfa04rbg0HIBImQ6O9+QlgjpWg
 C31TC0I9GVJuSW+o0dsGcziaE4zV1s1P7Hjv9ZoYSf2W0CbIY9p59DvkU9R+sUOGhq2GCyUhr
 ra56zALK6P56g3duMk8cpotV90yy/mUTHuwb+qTzn7mF9PGaMUzmkKvdoCzU1I02BgK3UsEM5
 5kVs3/MyqxZHZOqllFV41oCAa7goE/Kyxdwit8pWnGj5hhHjGSWr/DHYzDuZUa4IWdiZw1WC1
 AqyG7hRR8lYEiWBU43InSgUOf6Oqr9toedxYw8gUCMfme7JbN/0WhzrZm+nk1ESWmocfPc/i3
 SRqWjtUtkr8j6WHr/q9+6KEQ6rOxLGrzJIHm15bNnrkghEtPEiRVgSTgZAlWkVvddTurT5ozX
 JZVttV4e5GbyJU8hVLQREaRu9x7Mec2KCMDv2/Ycvk669wPvvY=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 29786
Cc: 29786 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Stefan Monnier <monnier@HIDDEN> writes:

> > (cl-defmethod seq-mapn (function (stream stream) &rest streams)
> >   "Map FUNCTION over the STREAMS.
> >
> > Example: this prints the first ten Fibonacci numbers:
> >
> >   (letrec ((fibs (stream-cons
> >                   1
> >                   (stream-cons
> >                    1
> >                    (seq-mapn #'+ fibs (stream-rest fibs))))))
> >     (seq-do #'print (seq-take fibs 10)))
> >
> > \(fn FUNCTION STREAMS...)"
>
> I think this "\(fn FUNCTION STREAMS...)" thingy doesn't make sense for
> `cl-defmethod`: it only makes sense for `cl-defgeneric`.

But it does make sense in this example, no?


Thanks,

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29786; Package emacs. Full text available.

Message received at 29786 <at> debbugs.gnu.org:


Received: (at 29786) by debbugs.gnu.org; 27 Dec 2017 03:01:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 26 22:01:36 2017
Received: from localhost ([127.0.0.1]:53036 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eU1yJ-00012L-OA
	for submit <at> debbugs.gnu.org; Tue, 26 Dec 2017 22:01:35 -0500
Received: from chene.dit.umontreal.ca ([132.204.246.20]:50266)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1eU1yG-00012C-Tn
 for 29786 <at> debbugs.gnu.org; Tue, 26 Dec 2017 22:01:33 -0500
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
 [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vBR31UQg025682;
 Tue, 26 Dec 2017 22:01:30 -0500
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id DD4D7AE27E; Tue, 26 Dec 2017 22:01:29 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#29786: 27.0.50; About the argument list of methods
Message-ID: <jwvy3lo3o4z.fsf-monnier+bug#29786@HIDDEN>
References: <87d139a81c.fsf@HIDDEN>
Date: Tue, 26 Dec 2017 22:01:29 -0500
In-Reply-To: <87d139a81c.fsf@HIDDEN> (Michael Heerdegen's message of "Wed, 20
 Dec 2017 13:38:39 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV6187=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6187> : inlines <6288> : streams
 <1774280> : uri <2557990>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 29786
Cc: 29786 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> It's not clear to me what the sentence saying the argument lists must
> all be identical tries to say.  Surely they can't all be identical when
> they need to specify different specializers?

All that matters is that they should all accept the same number of arguments.

> (cl-defmethod seq-mapn (function (stream stream) &rest streams)
>   "Map FUNCTION over the STREAMS.
>
> Example: this prints the first ten Fibonacci numbers:
>
>   (letrec ((fibs (stream-cons
>                   1
>                   (stream-cons
>                    1
>                    (seq-mapn #'+ fibs (stream-rest fibs))))))
>     (seq-do #'print (seq-take fibs 10)))
>
> \(fn FUNCTION STREAMS...)"

I think this "\(fn FUNCTION STREAMS...)" thingy doesn't make sense for
`cl-defmethod`: it only makes sense for `cl-defgeneric`.

> (cl-defmethod seq-mapn (function (sequence stream) &rest sequences)
>   "Map FUNCTION over the STREAMS.
[...]
>     (seq-do #'print (seq-take fibs 10)))"
[...]
> That gives me for C-h f:
>
> Implementations:
>
> (sequence (arg1 stream) &rest sequences) in `~/software/elpa/packages/stream/stream.el'.

Oh, indeed, we have a bug in cl--generic-lambda:
We create a (cl-function (lambda (function stream &rest streams) ...)),
then macroexpand it, then retro-fit an additional `cnm` argument (the
implicit argument that holds the "next method", used by
cl-call-next-method).  But when we retro-fit this `cnm` argument, we're
not careful to update the potential (fn FOO) stuff added at the end of
the docstring.

Not sure how best to fix it,


        Stefan "who curses the idiot who came up with this gross (fn FOO) hack"




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29786; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Dec 2017 12:38:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 20 07:38:55 2017
Received: from localhost ([127.0.0.1]:43233 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eRdeA-0004AE-Kd
	for submit <at> debbugs.gnu.org; Wed, 20 Dec 2017 07:38:54 -0500
Received: from eggs.gnu.org ([208.118.235.92]:44582)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1eRde9-0004A2-Mc
 for submit <at> debbugs.gnu.org; Wed, 20 Dec 2017 07:38:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1eRde3-00051D-9p
 for submit <at> debbugs.gnu.org; Wed, 20 Dec 2017 07:38:48 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44415)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1eRde3-000517-7E
 for submit <at> debbugs.gnu.org; Wed, 20 Dec 2017 07:38:47 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35487)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1eRde1-0005ZI-Ri
 for bug-gnu-emacs@HIDDEN; Wed, 20 Dec 2017 07:38:47 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1eRddy-0004wy-K3
 for bug-gnu-emacs@HIDDEN; Wed, 20 Dec 2017 07:38:45 -0500
Received: from mout.web.de ([212.227.15.3]:59764)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1eRddy-0004vM-9o
 for bug-gnu-emacs@HIDDEN; Wed, 20 Dec 2017 07:38:42 -0500
Received: from drachen.dragon ([88.74.120.211]) by smtp.web.de (mrweb002
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MVtqS-1eTmIZ2U4O-00X8MC for
 <bug-gnu-emacs@HIDDEN>; Wed, 20 Dec 2017 13:38:39 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; About the argument list of methods
Date: Wed, 20 Dec 2017 13:38:39 +0100
Message-ID: <87d139a81c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K0:BcUU6bidW+sKwcv2N6afGrnn3x4XjpIsE2EG4zmGMPFZotDzpZI
 hMKa2jhzCCCp3XUAm5PoDPI724x3T0gzvT4HHiGon7UHK5YQe57uNg5goNNq/fR+zz/+Ae8
 Gh4Ir0RGyg0++Wx2+SIdfCMIZVI1/L8FOMTpP3EhkLNNAhOUhBhHrR01YPsq3QUOIsleEo9
 QiwYe60mLWakiodMUIpVA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:sgSy5b7S0zM=:VO+CJFTnnNlsdlhmiyLOlf
 iFJNDaPhFwJvveZ11ZOrLl1kFj6vI7BcNFfhIHvTkJi4bf7Ti4h1VMpTdB6otlRg5wTK8x1ND
 EQux/MK6u/EOrCo+C/ONVDfP6NeSyEqujq3U47NIecKO5pCuFOyPo1vN0uv7u+J6oIKR0HkoI
 /laPPO9ppeQNzSHNmozZ3UFM9nUKV5CFczFit+SDPHvBrsykTEOmurDl+HvmlmXggu50bC0nO
 4wBiZVhZry98XNudCgVyOoLLy8ERgASRVkm0yJJCydw/I6tYGIJFKqELDHjgEU4hhy+HPHusP
 +jW0BiyhUwgUaEsCe4YC+Q23AjTMFwdXsGHo28ifzPEKUSu6Li6d4bsxHcGcct+2qCJQVaLRD
 RzXuaYAcDDnXjht6t1sMxcHIvDArmYozcvye/ohiR7Ugw4K3ouDQNO6U/128v3CrcMylh6pW6
 nFEeED3zo7LB1/AxlllsksBijuN3Aj2AmpU1ZauGvZjfVsTdoU/JpLH7P2WQ7hEHWLTKcOV2X
 wHw4Utu6Q/9AQ40rAmVCrD1kD3uNVXrO5JWy4UP1I7O2QLT1L2CGMqKTGb2Y+4PSY0At0V2UA
 8i6z6pVXO2kXh/a5QLN7xRR75+oJRy81ksRtao0DvH6IJKu7JVVppX6eJDOFpLVa/6BwyzoQS
 wJtWf/aLSOWZtyUn48auYsXyUceEdNWMSREdXSq2YLQ/ze7gJCTiVRWHsRbQZjLQkYZXRNAN7
 BiXcJSkpjKpjhsAYGhM+tZ3V/2pjmuwMfU/amcuFfQFUu21KZcz4t6jiWUzMQgOftuGj8br7Y
 i/2JYXP9Pomxro3MtYbsNPLpTUxnoyoFx7TZ/CWVtbqWXrXz8E=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)


Hello,

(1) In (info "(elisp) Generic Functions"), there is this paragraph:

 -- Macro: cl-defmethod name [qualifier] arguments &rest [docstring]
          body
     [...]
     The ARGUMENTS list, which must be identical in all the methods that
     implement a generic function, and must match the argument list of
     that function, provides argument specializers of the form =E2=80=98(ARG
     SPEC)=E2=80=99, where ARG is the argument name as specified in the
     =E2=80=98cl-defgeneric=E2=80=99 call, and SPEC is one of the following=
 specializer
     forms: [...]

It's not clear to me what the sentence saying the argument lists must
all be identical tries to say.  Surely they can't all be identical when
they need to specify different specializers?  Is there anything to say
at all, apart from the necessity to match the argument list of the
generic function mentioned in the next sentence?  Do I have to use the
same argument names as specified in the generic method?  That would be
suboptimal for my use case:

(2)  I want to implement a method of `seq-mapn' (see seq.el) for
streams.  It would be good if the following worked as expected:

#+begin_src emacs-lisp
(cl-defmethod seq-mapn (function (stream stream) &rest streams)
  "Map FUNCTION over the STREAMS.

Example: this prints the first ten Fibonacci numbers:

  (letrec ((fibs (stream-cons
                  1
                  (stream-cons
                   1
                   (seq-mapn #'+ fibs (stream-rest fibs))))))
    (seq-do #'print (seq-take fibs 10)))

\(fn FUNCTION STREAMS...)"
  (if (not (seq-every-p #'streamp streams))
      (cl-call-next-method)
    (cl-labels ((helper (f streams)
                        (stream-make
                         (unless (seq-some #'stream-empty-p streams)
                           (cons (apply f (mapcar #'stream-first streams))
                                 (helper f (mapcar #'stream-rest streams)))=
))))
      (helper function (cons stream streams)))))
#+end_src

Then C-h f seq-mapn prints the argument list of that method as

  (arg2 (arg3 stream) &rest rest)

Debugging suggested that "STREAMS..." is treated as a symbol name by the
code and rejected because it contains dots.

But even when I replace the signature specifying line at the end of the
docstring with "\(fn FUNCTION &rest STREAMS)", I get

  (arg0 (arg1 stream) &rest streams)

instead of what I have specified.  This only happens if I load the
byte-compiled code, however.

I think the documentation tries to say that I have to use exactly the
same argument names as in the generic method:

#+begin_src emacs-lisp
(cl-defmethod seq-mapn (function (sequence stream) &rest sequences)
  "Map FUNCTION over the STREAMS.

Example: this prints the first ten Fibonacci numbers:

  (letrec ((fibs (stream-cons
                  1
                  (stream-cons
                   1
                   (seq-mapn #'+ fibs (stream-rest fibs))))))
    (seq-do #'print (seq-take fibs 10)))"
  (if (not (seq-every-p #'streamp sequences))
      (cl-call-next-method)
    (cl-labels ((helper (f streams)
                        (stream-make
                         (unless (seq-some #'stream-empty-p streams)
                           (cons (apply f (mapcar #'stream-first streams))
                                 (helper f (mapcar #'stream-rest streams)))=
))))
      (helper function (cons sequence sequences)))))
#+end_src

That gives me for C-h f:

Implementations:

(sequence (arg1 stream) &rest sequences) in `~/software/elpa/packages/strea=
m/stream.el'.

That's a total mess now: the first argument FUNCTION is called
"sequence", the second arg "arg1", and the third &rest argument
"sequences", which is not what I want because these must all be streams
(as tested in the method body), so this results in the most confusing
generated documentation of all.


TIA,

Michael.


In GNU Emacs 27.0.50 (build 24, x86_64-pc-linux-gnu, GTK+ Version 3.22.24)
 of 2017-12-14 built on drachen
Repository revision: 269fa5482d0761e612734b87982d7a708330bd37
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description: Debian GNU/Linux testing (buster)





Acknowledgement sent to Michael Heerdegen <michael_heerdegen@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#29786; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.