unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72888: Confusing descriptive text
@ 2024-08-30  6:58 麻枝忠
  2024-08-30 10:59 ` Eli Zaretskii
  2024-08-31 12:37 ` Mattias Engdegård
  0 siblings, 2 replies; 7+ messages in thread
From: 麻枝忠 @ 2024-08-30  6:58 UTC (permalink / raw)
  To: 72888

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Equality Predicates (GNU Emacs Lisp Reference Manual)
<https://www.gnu.org/software/emacs/manual/html_node/elisp/Equality-Predicates.html>

In the descriptive text of function "equal":

"The equal function recursively compares the contents of objects if they
are integers, strings, markers, vectors, bool-vectors, byte-code function
objects, char-tables, records, or font objects."

Shouldn't "integers" here be "conses" or "lists"?

[-- Attachment #2: Type: text/html, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-30  6:58 bug#72888: Confusing descriptive text 麻枝忠
@ 2024-08-30 10:59 ` Eli Zaretskii
  2024-08-31 12:37 ` Mattias Engdegård
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-08-30 10:59 UTC (permalink / raw)
  To: 麻枝忠; +Cc: 72888-done

> From: 麻枝忠 <maedaqu@gmail.com>
> Date: Fri, 30 Aug 2024 14:58:47 +0800
> 
> Equality Predicates (GNU Emacs Lisp Reference Manual)
> 
> In the descriptive text of function "equal":
> 
> "The equal function recursively compares the contents of objects if they are integers, strings, markers, vectors,
> bool-vectors, byte-code function objects, char-tables, records, or font objects."
> 
> Shouldn't "integers" here be "conses" or "lists"?

No (an integer could be a fixnum or a bignum), but lists and conses
should be in that list.  I've now added that on the emacs-30 release
branch, and I'm therefore closing this bug.  Thanks for pointing out
the omission.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-30  6:58 bug#72888: Confusing descriptive text 麻枝忠
  2024-08-30 10:59 ` Eli Zaretskii
@ 2024-08-31 12:37 ` Mattias Engdegård
  2024-08-31 12:58   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Mattias Engdegård @ 2024-08-31 12:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72888, 麻枝忠

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Thank you for making this text better. It can be made even more accurate: neither integers nor strings or bool-vectors are actually compared recursively in a useful sense so we shouldn't claim that they are, and nowadays both byte-compiled and interpreted closures are compiled but we should note the usual intensionality problems when comparing functions.

Here is a proposed amendment.


[-- Attachment #2: equal-doc.diff --]
[-- Type: application/octet-stream, Size: 797 bytes --]

diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index 399a1d169c2..58577ed06c4 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -2414,9 +2414,9 @@ Equality Predicates
 @end example
 
 The @code{equal} function recursively compares the contents of objects
-if they are integers, strings, markers, lists, cons cells, vectors,
-bool-vectors, byte-code function objects, char-tables, records, or font
-objects.
+if they are lists, cons cells, vectors, records, markers, char-tables,
+font objects, or function objects (closures)@footnote{However, equality
+of distinct function objects cannot be guaranteed in general.).
 
 Comparison of strings is case-sensitive, but does not take account of
 text properties---it compares only the characters in the strings.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-31 12:37 ` Mattias Engdegård
@ 2024-08-31 12:58   ` Eli Zaretskii
  2024-08-31 14:37     ` Mattias Engdegård
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-08-31 12:58 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 72888, maedaqu

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Sat, 31 Aug 2024 14:37:26 +0200
> Cc: 麻枝忠 <maedaqu@gmail.com>,
>  72888@debbugs.gnu.org
> 
> Thank you for making this text better. It can be made even more accurate: neither integers nor strings or bool-vectors are actually compared recursively in a useful sense so we shouldn't claim that they are, and nowadays both byte-compiled and interpreted closures are compiled but we should note the usual intensionality problems when comparing functions.
> 
> Here is a proposed amendment.

Doesn't that lose useful information?  It only tells what is compared
recursively, but doesn't tell about comparing strings or integers or
bool-vectors by themselves, which is IMO important.

IOW, given your proposed text, how do we explain that

  (equal "foo" (substring "foobar" nil -3)) => t





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-31 12:58   ` Eli Zaretskii
@ 2024-08-31 14:37     ` Mattias Engdegård
  2024-08-31 16:07       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Mattias Engdegård @ 2024-08-31 14:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72888, maedaqu

31 aug. 2024 kl. 14.58 skrev Eli Zaretskii <eliz@gnu.org>:

> Doesn't that lose useful information?  It only tells what is compared
> recursively, but doesn't tell about comparing strings or integers or
> bool-vectors by themselves, which is IMO important.

That's a fair point. What about something like:

The @code{equal} function compares numbers, strings and bool-vectors by
value.  Lists, cons cells, vectors, records, markers, char-tables,
font objects, and function objects (closures)@footnote{However, equality
of distinct function objects cannot be guaranteed in general.} are
compared recursively by using @code{equal} on their constituent parts.







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-31 14:37     ` Mattias Engdegård
@ 2024-08-31 16:07       ` Eli Zaretskii
  2024-08-31 16:47         ` Mattias Engdegård
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-08-31 16:07 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 72888, maedaqu

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Sat, 31 Aug 2024 16:37:56 +0200
> Cc: maedaqu@gmail.com,
>  72888@debbugs.gnu.org
> 
> 31 aug. 2024 kl. 14.58 skrev Eli Zaretskii <eliz@gnu.org>:
> 
> > Doesn't that lose useful information?  It only tells what is compared
> > recursively, but doesn't tell about comparing strings or integers or
> > bool-vectors by themselves, which is IMO important.
> 
> That's a fair point. What about something like:
> 
> The @code{equal} function compares numbers, strings and bool-vectors by
> value.  Lists, cons cells, vectors, records, markers, char-tables,
> font objects, and function objects (closures)@footnote{However, equality
> of distinct function objects cannot be guaranteed in general.} are
> compared recursively by using @code{equal} on their constituent parts.

SGTM, thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72888: Confusing descriptive text
  2024-08-31 16:07       ` Eli Zaretskii
@ 2024-08-31 16:47         ` Mattias Engdegård
  0 siblings, 0 replies; 7+ messages in thread
From: Mattias Engdegård @ 2024-08-31 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72888, maedaqu

31 aug. 2024 kl. 18.07 skrev Eli Zaretskii <eliz@gnu.org>:

> SGTM, thanks.

Thank you, push with minor tweak to emacs-30.






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-08-31 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30  6:58 bug#72888: Confusing descriptive text 麻枝忠
2024-08-30 10:59 ` Eli Zaretskii
2024-08-31 12:37 ` Mattias Engdegård
2024-08-31 12:58   ` Eli Zaretskii
2024-08-31 14:37     ` Mattias Engdegård
2024-08-31 16:07       ` Eli Zaretskii
2024-08-31 16:47         ` Mattias Engdegård

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).