GNU bug report logs - #39557
27.0.60; Elisp manual, doc about bignums

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 10 Feb 2020 23:56:01 UTC

Severity: wishlist

Found in version 27.0.60

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39557 in the body.
You can then email your comments to 39557 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Mon, 10 Feb 2020 23:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 10 Feb 2020 23:56:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 10 Feb 2020 15:55:03 -0800 (PST)
The Elisp manual's presentation of fixnums and bignums could be
improved.  It should say something similar to what the Common Lisp
manual says:

  Common Lisp is designed to hide this distinction as much as possible;
  the distinction between fixnums and bignums is visible to the user in
  only a few places where the efficiency of representation is important.
  Exactly which integers are fixnums is implementation-dependent;
  typically they will be those integers in the range -2**n to 2**(n-1),
  inclusive, for some n not less than 15.  See most-positive-fixnum and
  most-negative-fixnum.

IOW, don't worry about whether an integer is a fixnum or a bignum, in
general.

Instead, right off the bat the Elisp doc tells users:

  Some functions in Emacs accept only fixnums.  Also, while fixnums can
  always be compared for numeric equality with 'eq', bignums require
  more-heavyweight equality predicates like 'eql'."

That's really the _last_ thing we should tell users, not the first.

And even if we tell them something like that we should NOT emphasize
using `eq' ("bignums _require_...").  We should NOT give users the
impression that they should want to avoid the "more-heavyweight"
comparison function `eql'.

We should instead tell users, right away, that they can (and typically
should) use `eql' for comparing any integers, regardless of whether they
happen, on this or that platform/machine, to be fixnums or bignums.

I'm really surprised this doc got inserted as it is.

Using `eq' is only an optimisation; it's platform/machine-specific; and
it makes users worry about whether the numbers being compared are both
fixnums.  (Sure, they can always test first with `fixnump' or `bignump',
but still...)

And I don't see where the doc tells you how the Lisp reader treats an
integer numeral - when it gives you a fixnum and when it gives you a
bignum.  Shouldn't it tell you that you get a fixnum whenever the value
is within the fixnum range (if that's in fact the case)?  I mean, if
you're going to be comparing against a literal value, and the doc slants
you toward using `eq' as it does, you'll at least want to know whether
some numeral ends up as a fixnum or a bignum.  (Sure, you can always
test it...)

(BTW, this doc should probably also mention that the numerical value of
a marker is an integer.  Sure, if they follow the link to node Markers
they'll find that out, but still.)



In GNU Emacs 27.0.60 (build 1, x86_64-w64-mingw32)
 of 2019-12-28
Repository revision: 21c3020fcec0a32122d2680a391864a75393031b
Windowing system distributor `Microsoft Corp.', version 10.0.18362
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install -C 'CFLAGS=-O2 -static -g3''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 11 Feb 2020 17:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 19:01:51 +0200
> Date: Mon, 10 Feb 2020 15:55:03 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> 
>   Some functions in Emacs accept only fixnums.  Also, while fixnums can
>   always be compared for numeric equality with 'eq', bignums require
>   more-heavyweight equality predicates like 'eql'."
> 
> That's really the _last_ thing we should tell users, not the first.
> 
> And even if we tell them something like that we should NOT emphasize
> using `eq' ("bignums _require_...").  We should NOT give users the
> impression that they should want to avoid the "more-heavyweight"
> comparison function `eql'.
> 
> We should instead tell users, right away, that they can (and typically
> should) use `eql' for comparing any integers, regardless of whether they
> happen, on this or that platform/machine, to be fixnums or bignums.
> 
> I'm really surprised this doc got inserted as it is.
> 
> Using `eq' is only an optimisation; it's platform/machine-specific; and
> it makes users worry about whether the numbers being compared are both
> fixnums.  (Sure, they can always test first with `fixnump' or `bignump',
> but still...)
> 
> And I don't see where the doc tells you how the Lisp reader treats an
> integer numeral - when it gives you a fixnum and when it gives you a
> bignum.  Shouldn't it tell you that you get a fixnum whenever the value
> is within the fixnum range (if that's in fact the case)?  I mean, if
> you're going to be comparing against a literal value, and the doc slants
> you toward using `eq' as it does, you'll at least want to know whether
> some numeral ends up as a fixnum or a bignum.  (Sure, you can always
> test it...)

There seems to be a contradiction here: where we do describe the
difference between fixnums and bignums, you argue that we shouldn't,
but then you pick up a place where we don't distinguish between them,
and you argue that we should...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 11 Feb 2020 18:27:01 GMT) Full text and rfc822 format available.

Message #11 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: 39557 <at> debbugs.gnu.org
Subject: RE: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 10:26:08 -0800 (PST)
> >   Some functions in Emacs accept only fixnums.  Also, while fixnums can
> >   always be compared for numeric equality with 'eq', bignums require
> >   more-heavyweight equality predicates like 'eql'."
> >
> > That's really the _last_ thing we should tell users, not the first.
> >
> > And even if we tell them something like that we should NOT emphasize
> > using `eq' ("bignums _require_...").  We should NOT give users the
> > impression that they should want to avoid the "more-heavyweight"
> > comparison function `eql'.
> >
> > We should instead tell users, right away, that they can (and typically
> > should) use `eql' for comparing any integers, regardless of whether they
> > happen, on this or that platform/machine, to be fixnums or bignums.
> >
> > I'm really surprised this doc got inserted as it is.
> >
> > Using `eq' is only an optimisation; it's platform/machine-specific; and
> > it makes users worry about whether the numbers being compared are both
> > fixnums.  (Sure, they can always test first with `fixnump' or `bignump',
> > but still...)
> >
> > And I don't see where the doc tells you how the Lisp reader treats an
> > integer numeral - when it gives you a fixnum and when it gives you a
> > bignum.  Shouldn't it tell you that you get a fixnum whenever the value
> > is within the fixnum range (if that's in fact the case)?  I mean, if
> > you're going to be comparing against a literal value, and the doc slants
> > you toward using `eq' as it does, you'll at least want to know whether
> > some numeral ends up as a fixnum or a bignum.  (Sure, you can always
> > test it...)
> 
> There seems to be a contradiction here: where we do describe the
> difference between fixnums and bignums, you argue that we shouldn't,
> but then you pick up a place where we don't distinguish between them,
> and you argue that we should...

Maybe read again what I wrote.

I didn't say we should not describe the
difference between the two.  Not at all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 11 Feb 2020 19:15:02 GMT) Full text and rfc822 format available.

Message #14 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 21:14:07 +0200
> Date: Tue, 11 Feb 2020 10:26:08 -0800 (PST)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 39557 <at> debbugs.gnu.org
> 
> > There seems to be a contradiction here: where we do describe the
> > difference between fixnums and bignums, you argue that we shouldn't,
> > but then you pick up a place where we don't distinguish between them,
> > and you argue that we should...
> 
> Maybe read again what I wrote.

Maybe read again what I wrote.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 11 Feb 2020 21:48:01 GMT) Full text and rfc822 format available.

Message #17 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39557 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 16:46:53 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

> There seems to be a contradiction here: where we do describe the
> difference between fixnums and bignums, you argue that we shouldn't,
> but then you pick up a place where we don't distinguish between them,
> and you argue that we should...

I think Drew intended the argument that we should distinguish them as a
sarcastic reductio ad absurdum.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 11 Feb 2020 22:35:01 GMT) Full text and rfc822 format available.

Message #20 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 39557 <at> debbugs.gnu.org
Subject: RE: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 14:34:22 -0800 (PST)
> > There seems to be a contradiction here: where we do describe the
> > difference between fixnums and bignums, you argue that we shouldn't,
> > but then you pick up a place where we don't distinguish between them,
> > and you argue that we should...
> 
> I think Drew intended the argument that we should distinguish them as a
> sarcastic reductio ad absurdum.

Not at all.  I wonder why you would think that,
especially when I reiterated:

   I didn't say we should not describe the
   difference between the two.  Not at all.

It's appropriate to distinguish them in the doc,
since they are distinguished in reality.  They
have different behavior.

I argued for treatment similar to what the Common
Lisp doc provides.  (And I pointed to that doc.
You might want to take a look.)

The Common Lisp doc guides you to, a priori,
treating them the same in your code that uses
them.  That is, as a general rule, ignore their
difference as much as possible -- think integer.
And that means think (use) `eql'.

If and when you really need to distinguish them
in practice (rare), then do so.  And of course
the doc should tell you how to do that.

I object to the doc about integers starting off
by telling you "bignums require more-heavyweight
predicates like `eql'", and possibly giving the
mistaken impression that you should in general
try to use fixnums and `eq'.  That's the wrong
message to send, IMO, whether explicit or not.

The main message of the doc about integers and
comparison is that you should, in general, use
`eql' - not `eq'.  That message isn't delivered,
and if you think it is then I'll just suggest
that it's lost.

I didn't say that we shouldn't mention that
fixnums can be compared using `eq'.  I said
that's the _last_, not the first, thing we
should tell them about fixnums and bignums.

The fact that fixnums can be compared using
`eq' is _not_ a wonderful feature.  It can
even represent a liability - a risk that users
might compare integers generally using `eq'.

The use case for comparing integers with `eq'
is a corner case.

But this doc puts it front and center, as if
it were important, or a cool trick that real
lispers use: use fixnums as integers because
you can use `eq', which isn't so "heavyweight".

The message should be to compare integers with
`eql' - do NOT use `eq'.

---

We can (but we really need not) add that if,
for some reason, you know that both numbers
are fixnums, then you can use `eq'.  But don't
start with that.

I wouldn't suggest that we even add here that
using `eq' is more performant than `eql'.
Users who know more generally that `eq' is
faster than `eql' will know whether it makes
sense for them to use `eq' in any given case
when both integers are known to be fixnums.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Wed, 12 Feb 2020 15:54:02 GMT) Full text and rfc822 format available.

Message #23 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Wed, 12 Feb 2020 10:53:11 -0500
Drew Adams <drew.adams <at> oracle.com> writes:

>> > There seems to be a contradiction here: where we do describe the
>> > difference between fixnums and bignums, you argue that we shouldn't,
>> > but then you pick up a place where we don't distinguish between them,
>> > and you argue that we should...
>>
>> I think Drew intended the argument that we should distinguish them as a
>> sarcastic reductio ad absurdum.
>
> Not at all.  I wonder why you would think that,

When you said this:

    I mean, if you're going to be comparing against a literal value, and
    the doc slants you toward using `eq' as it does

since you *don't* want the doc to slant towards `eq', I read that
paragraph as sarcastic.

By the way, this

    I'm really surprised this doc got inserted as it is.

is too easily read as a snide jab (I know, you didn't mean it that way),
so it would be nice if you could leave out that kind of meta-opinion
from future reports.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Wed, 12 Feb 2020 20:07:01 GMT) Full text and rfc822 format available.

Message #26 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: eliz <at> gnu.org, 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Wed, 12 Feb 2020 15:06:40 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I think Drew intended the argument that we should distinguish them as a
  > sarcastic reductio ad absurdum.

I urge everyone to avoid sarcasm on our mailing lists.
It creates a risk of misunderstandings, and gives no benefit.

See https://gnu.org/philosophy/kind-communication.html.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Wed, 12 Feb 2020 21:37:01 GMT) Full text and rfc822 format available.

Message #29 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39557 <at> debbugs.gnu.org
Subject: RE: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Wed, 12 Feb 2020 13:36:20 -0800 (PST)
> >> I think Drew intended the argument that we should
> >> distinguish them as a sarcastic reductio ad absurdum.
> >
> > Not at all.  I wonder why you would think that,
> 
> When you said this:
> 
>     I mean, if you're going to be comparing against a
>     literal value, and the doc slants you toward using
>     `eq' as it does
> 
> since you *don't* want the doc to slant towards `eq',
> I read that paragraph as sarcastic.

The actual quote:

  And I don't see where the doc tells you how the Lisp
  reader treats an integer numeral - when it gives you
  a fixnum and when it gives you a bignum.  Shouldn't
  it tell you that you get a fixnum whenever the value
  is within the fixnum range (if that's in fact the case)?
  I mean, if you're going to be comparing against a
  literal value, and the doc slants you toward using
  `eq' as it does, you'll at least want to know whether
  some numeral ends up as a fixnum or a bignum.

There's nothing the least bit sarcastic in any of that.

That point/question is about what happens when a
numeral is read and interpreted by Lisp.  It
suggests that we say something about that case.
To use `eq' with a numeral you need to know when
it's handled as a fixnum.

If you use `eql' then that's not a consideration -
you don't really need to know how the numeral is
handled.  But since the doc currently, in effect,
promotes the use of `eq' somewhat, providing such
info might help.

There's no reductio ad absurdum there, let alone
a sarcastic one.

Putting this differently, if you compare an integer
against an integer numeral then you had better use
`eql', unless you know that both are fixnums, and
for the latter to be true you need to know how
numerals are handled.

I'm guessing the following rule applies also in
the case of interpreting a numeral - but if so
then maybe it would help to say so explicitly:

  if Emacs computes an integer in fixnum range, it
  represents the integer as a fixnum, not a bignum.

It's easy to think that a numeral isn't "computed",
and so to not think that this rule applies to a
numeral.  At least I, as one reader, wondered how
numerals are handled.

> By the way, this
> 
>     I'm really surprised this doc got inserted as it is.
> 
> is too easily read as a snide jab (I know, you
> didn't mean it that way), so it would be nice if
> you could leave out that kind of meta-opinion
> from future reports.

Is that a meta-opinion on your part? ;-)

I think it may be too easy for you to read it
that way because you're perhaps trying to read
my bug reports that way.  Maybe chill a bit?

Actually, I was just expressing my surprise,
as Eli usually shepherds new doc sufficiently
well that such things don't happen.  And I
mean that sincerely, as a compliment.

(Darn, another meta-opinion. (Darn, another
meta-meta-opinion that risks being taken as
sarcasm. (Darn, yet another. (D...))))

As for avoiding sarcasm (even humor) in mail:
Sure.  But a companion rule of etiquette
might be to avoid attributing malevolence
when a simple, constructive reading will do.
The golden rule implies offering the benefit
of the doubt.

The "you" in my bug report was consistently
the user.  The report was technical, not a
rant.  It wasn't I who took this to the
personal/meta level.  How about we turn now
to the technical content - the problem
reported?  Any thoughts on that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Thu, 13 Feb 2020 18:24:01 GMT) Full text and rfc822 format available.

Message #32 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Thu, 13 Feb 2020 13:23:43 -0500
Drew Adams <drew.adams <at> oracle.com> writes:

> There's nothing the least bit sarcastic in any of that.
[...]
> avoid attributing malevolence when a simple, constructive reading will
> do.  The golden rule implies offering the benefit of the doubt.

Yeah, I didn't intend to attribute malevolence; you wondered how I read
sarcasm (which, even if it might not be the best technique for
communication, isn't the same as ill-intent) in your message, so I
explained.

> Actually, I was just expressing my surprise,
> as Eli usually shepherds new doc sufficiently
> well that such things don't happen.  And I
> mean that sincerely, as a compliment.

Although I do believe you meant it that way, I still struggle to read
this as a compliment, even with the added explanation.

> to the technical content - the problem
> reported?  Any thoughts on that?

The idea is recommend using eql for comparing integers first, and move
the description of eq and fixnum/bignum distinction to the next
paragraph, right?

And also to document when the reader returns fixnums or bignums.  Though
I guess that might instead be solved by making the rule you cited
stronger to something like:

    Emacs always represents integers in fixnum range as a fixnum, not a
    bignum.

(Assuming that's true, which I believe it is)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Thu, 13 Feb 2020 21:04:02 GMT) Full text and rfc822 format available.

Message #35 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39557 <at> debbugs.gnu.org
Subject: RE: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Thu, 13 Feb 2020 13:03:46 -0800 (PST)
> > to the technical content - the problem
> > reported?  Any thoughts on that?
> 
> The idea is recommend using eql for comparing integers first, and move
> the description of eq and fixnum/bignum distinction to the next
> paragraph, right?

Almost.  Recommend `eql' generally for integers, even
as, i.e., even _after_, pointing out that integers
are either fixnums or bignums.  IOW, it's a general
recommendation, regardless of the fact that there
are two kinds of integers.

And in fact point out that you CANNOT use `eq', in
general, to compare integers.  That's part of the
point about recommending `eql'.  The recommendation
is in spite of the fact that there are two kinds of
integers - it applies to integers of both kinds, and
`eq' cannot be used with integers of both kinds.

And somewhere after that (whether the next paragraph
or not), get into the fact that you can use `eq' (in
addition to `eql') to compare two fixnums (BOTH must
be known to be fixnums) - IF you think it's important
to point that out.

I think it's important to point out that you can
_distinguish_ a fixnum from a bignum, and how to do
that.

But I can't say whether it's really important, in
this doc, to say that you can compare two fixnums
using `eq'.  A priori, I'd think not.

As I said earlier, AFAIK that's only an optimization,
and anyone who is liable to use/need such optimizing
should already know that `eq' is faster than `eql'.

I don't think that _this_ doc needs to or should
point out that `eql' is "more-heavyweight" than
`eq'.  That's not specific to integer comparison.

To be clear, I have no objection to saying that
you can use `eq' for two fixnums.  I'm just not
aware of why it's important to do that in this doc.

> And also to document when the reader returns fixnums or bignums.  Though
> I guess that might instead be solved by making the rule you cited
> stronger to something like:
> 
>   Emacs always represents integers in fixnum range
>   as a fixnum, not a bignum.
> 
> (Assuming that's true, which I believe it is)

Yes, that would be OK, provided we don't speak of
"computing" the integer, which can be misleading
for a literal (a numeral), or provided we make
clear that that rule applies also to numerals.

Thanks for working on this fix, if you do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Thu, 13 Feb 2020 23:44:02 GMT) Full text and rfc822 format available.

Message #38 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: eliz <at> gnu.org, 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Thu, 13 Feb 2020 18:43:46 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

If nobody was really being sarcastic, that's good news.
(We all misinterpret things sometimes.)

I still urge everyone to avoid sarcasm on our mailing lists.
See https://gnu.org/philosophy/kind-communication.html.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Mon, 17 Feb 2020 22:06:01 GMT) Full text and rfc822 format available.

Message #41 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 39557 <at> debbugs.gnu.org
Subject: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 17 Feb 2020 14:05:38 -0800
[Message part 1 (text/plain, inline)]
> That's really the _last_ thing we should tell users, not the first.

I installed the first attached patch to move the distinction between fixnums and 
bignums to the end of the section.

> Shouldn't it tell you that you get a fixnum whenever the value
> is within the fixnum range (if that's in fact the case)?

It already said that, but apparently not clearly enough. I installed the second 
attached patch to try to make things clearer.

> this doc should probably also mention that the numerical value of
> a marker is an integer

It already says "Many of the functions described in this chapter accept markers 
for arguments in place of numbers.... When the argument value is a marker, its 
position value is used and its buffer is ignored."

> if you compare an integer
> against an integer numeral then you had better use
> `eql', unless you know that both are fixnums

No, it suffices if *either* is a fixnum. For example, (eq 0 FOO) tests whether 
FOO is the integer zero, and works regardless of whether FOO is a bignum.

> I'm really surprised this doc got inserted as it is.

I'm not surprised at all. The doc was an improvement over its predecessor, we're 
all busy doing other things, and the issues raised in this bug report are low 
priority.

If you're still dissatisfied with the manual, I suggest proposing specific 
wording changes so that future fixes in this area can be accomplished more 
efficiently.
[0001-Reorder-discussion-of-integer-basics.patch (text/x-patch, attachment)]
[0002-Clarify-when-fixnums-are-used.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Mon, 17 Feb 2020 23:21:01 GMT) Full text and rfc822 format available.

Message #44 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 39557 <at> debbugs.gnu.org
Subject: RE: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 17 Feb 2020 15:19:54 -0800 (PST)
Thanks for working on this.

> > That's really the _last_ thing we should tell users, not the first.
> 
> I installed the first attached patch to move the distinction between fixnums
> and
> bignums to the end of the section.

Thanks.

> > Shouldn't it tell you that you get a fixnum whenever the value
> > is within the fixnum range (if that's in fact the case)?
> 
> It already said that, but apparently not clearly enough. I installed the
> second
> attached patch to try to make things clearer.

Thanks.

> > this doc should probably also mention that the numerical value of
> > a marker is an integer
                   ^^^^^^^
> It already says "Many of the functions described in this chapter accept
> markers for arguments in place of numbers.... When the argument value
> is a marker, its position value is used and its buffer is ignored."

Not really the same thing.  Nothing there says that
a marker position is an integer (fixnum or bignum),
and not some other kind of number.

Sure, many readers will know (but not from here)
that buffer positions are integers.  And they can
guess that marker positions are buffer positions,
hence integers...  But it's not hard to tell them
that the numerical value of a marker is an integer.

(This isn't a big deal.  I said "should probably
also mention".  I could have said "maybe".  Just a
suggestion.)

> > if you compare an integer
> > against an integer numeral then you had better use
> > `eql', unless you know that both are fixnums
> 
> No, it suffices if *either* is a fixnum. For example, (eq 0 FOO) tests
> whether
> FOO is the integer zero, and works regardless of whether FOO is a bignum.

I see.  Then please say that.

As for the proposed changes -

If we're going to talk about "older" code then
we should specify older than what.  I don't
think there should be any need to talk about
older code or say "should now".  The general
rule's simple: use `eql' - worked before,
works now.

If some code uses `eq', it couldn't possibly
have worked before with two integers big
enough to now be bignums, right?  Any code -
old or new - that uses `eq' to compare
integers needs to know that at least one of
the operands is a fixnum.

We should just say that you can use `eql' to
compare any integers, and add that you can't
use `eq' to compare integers if they're both
bignums.  How complicated is that?

Emphasize `=' and `eql'.  `eq' should just be
a footnote.  That's my suggestion.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Mon, 17 Feb 2020 23:54:01 GMT) Full text and rfc822 format available.

Message #47 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 39557 <at> debbugs.gnu.org
Subject: Re: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 17 Feb 2020 15:52:56 -0800
On 2/17/20 3:19 PM, Drew Adams wrote:

>>> this doc should probably also mention that the numerical value of
>>> a marker is an integer
>                     ^^^^^^^
>> It already says "Many of the functions described in this chapter accept
>> markers for arguments in place of numbers.... When the argument value
>> is a marker, its position value is used and its buffer is ignored."
> 
> Not really the same thing.  Nothing there says that
> a marker position is an integer (fixnum or bignum),
> and not some other kind of number.

That's clear from context. This section is titled "Integer Basics" and it's all 
about integers.

Personally I'd even trim some text from the above quote, as it's not basic to 
integers. I would rather not make that text longer or trickier.

>>> if you compare an integer
>>> against an integer numeral then you had better use
>>> `eql', unless you know that both are fixnums
>>
>> No, it suffices if *either* is a fixnum. For example, (eq 0 FOO) tests
>> whether
>> FOO is the integer zero, and works regardless of whether FOO is a bignum.
> 
> I see.  Then please say that.

I'd rather not. Again, this section is "Integer Basics" and the reference manual 
should not bog itself down various possible ways to use integers in programs 
(there are too many ways).

> If we're going to talk about "older" code then
> we should specify older than what.

I originally wrote "older than Emacs 27" but trimmed it as being nonessential 
before installing the patch. It's not a big deal either way.

> I don't
> think there should be any need to talk about
> older code or say "should now".

This bug report assumed that Emacs is basically like Common Lisp in this area. 
However, Emacs is not there yet (though we've made progress), and it's better if 
the documentation reflects that fact rather than pretending there's no 
difference from Common Lisp.

> Any code -
> old or new - that uses `eq' to compare
> integers needs to know that at least one of
> the operands is a fixnum.

It's sometimes OK to use eq even when both arguments are bignums. It depends on 
the circumstances.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 18 Feb 2020 01:53:01 GMT) Full text and rfc822 format available.

Message #50 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 39557 <at> debbugs.gnu.org
Subject: RE: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 17 Feb 2020 17:52:41 -0800 (PST)
> >> No, it suffices if *either* is a fixnum. For example, (eq 0 FOO) tests
> >> whether
> >> FOO is the integer zero, and works regardless of whether FOO is a bignum.
> >
> > I see.  Then please say that.
> 
> I'd rather not. Again, this section is "Integer Basics" and the reference
> manual
> should not bog itself down various possible ways to use integers in programs
> (there are too many ways).

Then remove all mention of `eq', if you don't
specify how it behaves with bignums.

> > If we're going to talk about "older" code then
> > we should specify older than what.
> 
> I originally wrote "older than Emacs 27" but trimmed it as being
> nonessential
> before installing the patch. It's not a big deal either way.

If it means nothing to say "older code" then
remove it altogether.  The hand waving just
confuses.

> > I don't
> > think there should be any need to talk about
> > older code or say "should now".
> 
> This bug report assumed that Emacs is basically like Common Lisp in this
> area.

No, it doesn't.  Whatever Emacs Lisp users need
to know about integers is what they should be
told.  If they need to be told something about
`eq' then tell that.

> However, Emacs is not there yet (though we've made progress), and it's
> better if
> the documentation reflects that fact rather than pretending there's no
> difference from Common Lisp.

AFAIK, I didn't say anything that contradicts that.
I'd never suggest that Emacs Lisp doc pretend that
Emacs Lisp is the same as Common Lisp where it's
not.

I mentioned CL because its doc is clear wrt the
use of `eql' for numbers.  If the Emacs doc can't
say the same thing, that's fine; it should say
what it needs to say, to make clear its own
behavior.  It shouldn't waffle or confuse users.

> > Any code -
> > old or new - that uses `eq' to compare
> > integers needs to know that at least one of
> > the operands is a fixnum.
> 
> It's sometimes OK to use eq even when both arguments are bignums. It depends
> on the circumstances.

Either it's important to say how `eq' behaves with
bignums or it's not.  

If it is, then users deserve the straight info.
If it's not, why talk about `eq' at all?  In that
case, why not just tell users to compare integers
using `eql' or `='?

You seem to be trying to have your cake and eat
it too.  You seem to want to talk about `eq' in
the context of integers, but you apparently don't
want to say how it behaves.

I don't see how that helps users.  My suggestion
is to either (1) really say what the deal is with
`eq' wrt integers (but not as the first thing we
say about integers - you've already moved it,
which is good) or (2) say nothing about it, other
than to recommend against using it and for using
`eql'.

Figure out what the real message is for users,
about using `eq' with integers - what they should
be told.  Then communicate it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Tue, 18 Feb 2020 03:14:02 GMT) Full text and rfc822 format available.

Message #53 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 39557 <at> debbugs.gnu.org
Subject: Re: 27.0.60; Elisp manual, doc about bignums
Date: Mon, 17 Feb 2020 19:13:47 -0800
On 2/17/20 5:52 PM, Drew Adams wrote:
> You seem to be trying to have your cake and eat
> it too.

I think we're done here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39557; Package emacs. (Fri, 25 Sep 2020 11:19:02 GMT) Full text and rfc822 format available.

Message #56 received at 39557 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Noam Postavsky <npostavs <at> gmail.com>,
 Drew Adams <drew.adams <at> oracle.com>, 39557 <at> debbugs.gnu.org
Subject: Re: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Fri, 25 Sep 2020 13:18:41 +0200
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> I think we're done here.

I think so, too, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 39557 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Sep 2020 11:20: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. (Fri, 23 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 176 days ago.

Previous Next


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