GNU bug report logs -
#23957
[PATCH] Make fboundp an alias for symbol-function
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23957 in the body.
You can then email your comments to 23957 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 15:50:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Robert Cochran <robert-emacs <at> cochranmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 12 Jul 2016 15:50:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello bug-gnu-emacs,
I was looking through the C portions of the Emacs source for fun, and
noticed a FIXME. I've wanted to start hacking on Emacs, the C portions
in specific, so I jumped right in.
My patch, attached, does the following:
* The function definition in src/data.c for fboundp has been removed,
along with the corresponding defsubr in syms_of_data, as suggested in
the FIXME
* All places where Ffboundp is used in the C code has been replaced with
Fsymbol_function
* A defalias form that makes fboundp an alias of symbol-function has
been inserted into lisp/subr.el
* In lisp/emacs-lisp/byte-run.el, and also lisp/loadup.el before loading
lisp/subr.el, all instances of fboundp have been replaced with
symbol-function
* All other instances of fboundp have been left alone
For anyone interested, I have a copy of the Emacs repository with the
patch applied here:
https://gitlab.com/RobertCochran/emacs/tree/alias-fboundp
I understand that the FSF requires a copyright assignment for
non-trivial patches made to Emacs, and this is likely considered
non-trivial. I am perfectly happy to do so, but require guidance on how
to accomplish it. On that topic, how can I go about this process so that
I automatically perform the appropriate assignments for each
contribution?
Please do offer suggestions and improvements for any deficiency in my
patch.
Thanks,
~Robert Cochran
[0001-Make-fboundp-an-alias-for-symbol-function.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 16:14:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 23957 <at> debbugs.gnu.org (full text, mbox):
Why would we do this?
It is not backward compatible, since `fboundp' returns t if
there is a function value and `symbol-function' returns that
function value. This will break any code that depends on
getting t or nil.
What is the point of this "fix"?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 17:41:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 23957 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Drew Adams <drew.adams <at> oracle.com> schrieb am Di., 12. Juli 2016 um
18:14 Uhr:
> It is not backward compatible, since `fboundp' returns t if
> there is a function value and `symbol-function' returns that
> function value. This will break any code that depends on
> getting t or nil.
>
And the docstring of `fboundp' does specify that it returns t (not just
non-nil), so this is indeed a breaking chance.
I'd suggest to simply remove the FIXME instead.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 17:50:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 23957 <at> debbugs.gnu.org (full text, mbox):
> And the docstring of `fboundp' does specify that it returns t
> (not just non-nil), so this is indeed a breaking chance.
Yes, I meant to add that. Thx.
> I'd suggest to simply remove the FIXME instead.
I'd be somewhat curious about who wrote it and why. Maybe
there is something else that could be done to satisfy whatever
the perceived need was.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 19:13:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 23957 <at> debbugs.gnu.org (full text, mbox):
I didn't put too much thought into reading the FIXME; I figured that
someone smarter than myself knew what they were doing when requesting
the change.
I'd personally argue that anyone making an explicit check for t, or
anything that particularly needs t rather than any true value is just
asking for lossage, but I can see why people would disagree with that
assertion.
FWIW, In every placed I changed occurrences of fboundp to
symbol-function, both in Lisp and C, used only the truthiness of the
return rather than explicitly checking for t.
I also ran the test suite with and without my patch applied, and noticed
no difference in the number of failing tests.
Anyways, I'm willing to toss this patch and do something else if that is
the general consensus.
Thanks,
~Robert Cochran
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 19:33:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 23957 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
>> I'd suggest to simply remove the FIXME instead.
>
> I'd be somewhat curious about who wrote it and why. Maybe
> there is something else that could be done to satisfy whatever
> the perceived need was.
I just did a blame for that line, and it lead back to commit eadf1faa
("Conflate Qnil and Qunbound for `symbol-function'.") by Stefan Monnier
<monnier <at> iro.umontreal.ca> (CC'd).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 20:08:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 23957 <at> debbugs.gnu.org (full text, mbox):
> I didn't put too much thought into reading the FIXME;
Nor did I. ;-)
> I figured that someone smarter than myself knew what they were
> doing when requesting the change.
Yes, no doubt s?he had a good reason. Or at least a reason.
But apparently it was not recorded, so we can only wonder or
guess.
My guess is that the person just figured that, like `member',
people can use `symbol-function' as a general Boolean - which
is true. But `fboundp' has been around forever, and there is
no telling what code might expect its value to be either `t'
or `nil'. And if someone really wants to use `symbol-function'
to either get the function or test whether there is one, s?he
can already do that.
> I'd personally argue that anyone making an explicit check for t, or
> anything that particularly needs t rather than any true value is just
> asking for lossage, but I can see why people would disagree with that
> assertion.
It doesn't matter what we might think of such a check. The point
is that such checks might exist, and there is really no good
reason (that I can see) for breaking such code. Again: anyone
can already use `symbol-function' to get the desired effect, and
its name speaks much better to the combined behavior desired in
that case.
> FWIW, In every placed I changed occurrences of fboundp to
> symbol-function, both in Lisp and C, used only the truthiness
> of the return rather than explicitly checking for t.
That's irrelevant (IMO). The code that GNU distributes with
Emacs is but a small part of the Emacs-Lisp code that is out
there.
> I also ran the test suite with and without my patch applied,
> and noticed no difference in the number of failing tests.
Again - you were testing in the tiny GNU Emacs distributed-code
sandbox. The Emacs world is a much bigger box.
> Anyways, I'm willing to toss this patch and do something else
> if that is the general consensus.
I can't speak for the consensus, but that would be my hope. And
thanks for pitching in! Sorry to seem so critical of a first foray
into helping.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 20:11:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 23957 <at> debbugs.gnu.org (full text, mbox):
> >> I'd suggest to simply remove the FIXME instead.
> >
> > I'd be somewhat curious about who wrote it and why. Maybe
> > there is something else that could be done to satisfy whatever
> > the perceived need was.
>
> I just did a blame for that line, and it lead back to commit eadf1faa
> ("Conflate Qnil and Qunbound for `symbol-function'.") by Stefan Monnier
> <monnier <at> iro.umontreal.ca> (CC'd).
Yes, well, perhaps Stefan will chime in with the reason(s) for it.
But to my mind the simple action "Conflate Qnil and Qunbound for
`symbol-function'" sounds like it is about doing something to
`symbol-function' rather than doing something to `fboundp'.
It is the behavior (hence meaning) of `fboundp' that changes
if you set it as an alias for `symbol-function'. The latter's
behavior does not change.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 20:36:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 23957 <at> debbugs.gnu.org (full text, mbox):
> And the docstring of `fboundp' does specify that it returns t (not just
> non-nil), so this is indeed a breaking chance.
> I'd suggest to simply remove the FIXME instead.
FWIW, the reason why I put a FIXME instead of making this change, is
that I wasn't sure indeed exactly how to make such a change.
I expect 99% of the uses of fboundp don't care about the distinction
between t and other non-nil values. And at least 90% of the remaining
1% is probably ill-advised to rely on this distinction. But the benefit
of redefining fboundp as an alias rather than as its own function is
probably too small to justify risking such breakage.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Tue, 12 Jul 2016 23:04:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 23957 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
>> I'd personally argue that anyone making an explicit check for t, or
>> anything that particularly needs t rather than any true value is just
>> asking for lossage, but I can see why people would disagree with that
>> assertion.
>
> It doesn't matter what we might think of such a check. The point
> is that such checks might exist, and there is really no good
> reason (that I can see) for breaking such code. Again: anyone
> can already use `symbol-function' to get the desired effect, and
> its name speaks much better to the combined behavior desired in
> that case.
>> FWIW, In every placed I changed occurrences of fboundp to
>> symbol-function, both in Lisp and C, used only the truthiness
>> of the return rather than explicitly checking for t.
>
> That's irrelevant (IMO). The code that GNU distributes with
> Emacs is but a small part of the Emacs-Lisp code that is out
> there.
>
>> I also ran the test suite with and without my patch applied,
>> and noticed no difference in the number of failing tests.
>
> Again - you were testing in the tiny GNU Emacs distributed-code
> sandbox. The Emacs world is a much bigger box.
Fair enough. I was never going to cast a net big enough to hit
everything. I agree with Stefan that most functions will be behave fine
in the face of the change, but given his hesitation, I'm not going to
push it. You guys know better than I do.
>> Anyways, I'm willing to toss this patch and do something else
>> if that is the general consensus.
>
> I can't speak for the consensus, but that would be my hope. And
> thanks for pitching in! Sorry to seem so critical of a first foray
> into helping.
Nah, don't worry about. I was expecting /something/ to snag my
patch. You clearly expressed your concerns about my changes, and we were
able to discuss and be civil. Best I can ask for, really. In the end,
I'll end up doing a cleanup of some sort, even if all that is is
removing the FIXME.
I've been hearing about how there are less and less people that
understand the C core of Emacs, so I'm aiming to help by becoming one of
those people. Barring any extreme levels of inter-personal friction in
getting things accomplished, I'm hopefully just getting started with
this.
Thanks,
~Robert Cochran
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Wed, 13 Jul 2016 02:16:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 23957 <at> debbugs.gnu.org (full text, mbox):
> I've been hearing about how there are less and less people that
> understand the C core of Emacs, so I'm aiming to help by becoming one of
> those people. Barring any extreme levels of inter-personal friction in
> getting things accomplished, I'm hopefully just getting started with
> this.
That is excellent. There are some really knowledgeable and
experienced Emacs C developers here (who are likewise for Emacs
Lisp development). I expect it would be a great project and a
great way to learn, to help with this. There are also others
who, like yourself, are tackling this fresh. Thank you.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Wed, 13 Jul 2016 05:36:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 23957 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> I expect 99% of the uses of fboundp don't care about the distinction
> between t and other non-nil values. And at least 90% of the remaining
> 1% is probably ill-advised to rely on this distinction. But the benefit
> of redefining fboundp as an alias rather than as its own function is
> probably too small to justify risking such breakage.
So then, is it generally agreed upon that I submit a new patch that
merely strips the FIXME, or does this need more discussion? Trying to
make sure I'm not jumping the gun by confirming before I do so.
Thanks,
~Robert Cochran
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23957
; Package
emacs
.
(Thu, 14 Jul 2016 22:54:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 23957 <at> debbugs.gnu.org (full text, mbox):
Submitted a patch to remove the FIXME as Bug#23988
~Robert Cochran
Forcibly Merged 23957 23988.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 14 Jul 2016 22:54:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 17 Jul 2016 01:45:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.1, send any further explanations to
23988 <at> debbugs.gnu.org and Robert Cochran <robert-emacs <at> cochranmail.com>
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 17 Jul 2016 01:45:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 14 Aug 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 2 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.