all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: 39557@debbugs.gnu.org
Subject: bug#39557: 27.0.60; Elisp manual, doc about bignums
Date: Tue, 11 Feb 2020 14:34:22 -0800 (PST)	[thread overview]
Message-ID: <7f19329d-6d7e-40e1-9c5c-ef6b58e25a62@default> (raw)
In-Reply-To: <85sgjgyeya.fsf@gmail.com>

> > 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.





  reply	other threads:[~2020-02-11 22:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 23:55 bug#39557: 27.0.60; Elisp manual, doc about bignums Drew Adams
2020-02-11 17:01 ` Eli Zaretskii
2020-02-11 21:46   ` Noam Postavsky
2020-02-11 22:34     ` Drew Adams [this message]
2020-02-12 15:53       ` Noam Postavsky
2020-02-12 21:36         ` Drew Adams
2020-02-13 18:23           ` Noam Postavsky
2020-02-13 21:03             ` Drew Adams
2020-02-12 20:06     ` Richard Stallman
2020-02-13 23:43     ` Richard Stallman
2020-02-17 22:05 ` Paul Eggert
2020-02-17 23:19   ` Drew Adams
2020-02-17 23:52     ` Paul Eggert
2020-02-18  1:52       ` Drew Adams
2020-02-18  3:13         ` Paul Eggert
2020-09-25 11:18           ` Lars Ingebrigtsen
     [not found] <<3d420026-bb32-413f-9a9c-304240aa82e2@default>
     [not found] ` <<8336bhrrb4.fsf@gnu.org>
2020-02-11 18:26   ` Drew Adams
2020-02-11 19:14     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f19329d-6d7e-40e1-9c5c-ef6b58e25a62@default \
    --to=drew.adams@oracle.com \
    --cc=39557@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.