# HG changeset patch # User Aidan Kehoe # Date 1211882322 -7200 # Node ID 2d39535e1f9d3557a3382ef0823ad5a47ace5a6a # Parent c76b1bc6bd28adf5c762d5575a55b9ac49dddc7b Say explicitly that eq is useful for chars; xref number comparison, lispref 2008-05-27 Aidan Kehoe * lispref/objects.texi (Equality Predicates): Cross reference to the section on comparison of numbers when talking about using #'eq with integers; also mention that #'eq gives t when passed identical integers, and that #'char= is also available there. diff -r c76b1bc6bd28 -r 2d39535e1f9d man/ChangeLog --- a/man/ChangeLog Tue May 27 12:01:29 2008 +0200 +++ b/man/ChangeLog Tue May 27 11:58:42 2008 +0200 @@ -1,3 +1,11 @@ +2008-05-27 Aidan Kehoe + + * lispref/objects.texi (Equality Predicates): + Cross reference to the section on comparison of numbers when + talking about using #'eq with integers; also mention that + #'eq gives t when passed identical integers, and that #'char= is + also available there. + 2008-05-21 Aidan Kehoe * internals/internals.texi (Ben's README): diff -r c76b1bc6bd28 -r 2d39535e1f9d man/lispref/objects.texi --- a/man/lispref/objects.texi Tue May 27 12:01:29 2008 +0200 +++ b/man/lispref/objects.texi Tue May 27 11:58:42 2008 +0200 @@ -2246,12 +2246,17 @@ change in one will be reflected by the same change in the other. @code{eq} returns @code{t} if @var{object1} and @var{object2} are -integers with the same value. Also, since symbol names are normally -unique, if the arguments are symbols with the same name, they are -@code{eq}. For other types (e.g., lists, vectors, strings), two -arguments with the same contents or elements are not necessarily -@code{eq} to each other: they are @code{eq} only if they are the same -object. +integers with the same value. It is preferable to use @code{=} or +@code{eql} in many contexts for numeric comparison; @pxref{Comparison of +Numbers}. @code{eq} also returns @code{t} if @var{object1} and +@var{object2} are identical characters, though in this case you may +prefer to use @code{char=}. + +Also, since symbol names are normally unique, if the arguments are +symbols with the same name, they are @code{eq}. For other types (e.g., +lists, vectors, strings), two arguments with the same contents or +elements are not necessarily @code{eq} to each other: they are @code{eq} +only if they are the same object. (The @code{make-symbol} function returns an uninterned symbol that is not interned in the standard @code{obarray}. When uninterned symbols @@ -2259,11 +2264,11 @@ the same name are not @code{eq}. @xref{Creating Symbols}.) NOTE: Under XEmacs 19, characters are really just integers, and thus -characters and integers are @code{eq}. Under XEmacs 20, it was -necessary to preserve remnants of this in function such as @code{old-eq} -in order to maintain byte-code compatibility. Byte code compiled -under any Emacs 19 will automatically have calls to @code{eq} mapped -to @code{old-eq} when executed under XEmacs 20. +characters and integers with the same numeric are @code{eq}. Under +XEmacs 20, it was necessary to preserve remnants of this in function +such as @code{old-eq} in order to maintain byte-code compatibility. +Byte code compiled under any Emacs 19 will automatically have calls to +@code{eq} mapped to @code{old-eq} when executed under XEmacs 20. @example @group