comparison man/lispref/objects.texi @ 5374:d967d96ca043

Conditionalise the old-* functions and byte codes at compile time. src/ChangeLog addition: 2011-03-15 Aidan Kehoe <kehoea@parhasard.net> * config.h.in (SUPPORT_CONFOUNDING_FUNCTIONS): New #define, equivalent NEED_TO_HANDLE_21_4_CODE by default, describing whether this XEmacs should support the old-eq, old-equal and related functions and byte codes. * bytecode.c (UNUSED): Only interpret old-eq, old-equal, old-memq if SUPPORT_CONFOUNDING_FUNCTIONS is defined. * data.c: Move Fold_eq to fns.c with the rest of the Fold_* functions. * fns.c: * fns.c (Fmemq): * fns.c (memq_no_quit): * fns.c (assoc_no_quit): * fns.c (Frassq): * fns.c (Fequal): * fns.c (Fold_equal): * fns.c (syms_of_fns): Group old-eq, old-equal, old-memq etc together, surround them with #ifdef SUPPORT_CONFOUNDING_FUNCTIONS. lisp/ChangeLog addition: 2011-03-15 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: Don't generate the old-eq, old-memq, old-equal bytecodes any more, but keep the information about them around for the sake of the disassembler. man/ChangeLog addition: 2011-03-15 Aidan Kehoe <kehoea@parhasard.net> * lispref/objects.texi (Character Type): * lispref/objects.texi (Equality Predicates): No longer document `old-eq', `old-equal', they haven't been used in years. tests/ChangeLog addition: 2011-03-17 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Only test the various old-* function if old-eq is bound and a subr.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 17 Mar 2011 20:13:00 +0000
parents f5a5501814f5
children 9fae6227ede5
comparison
equal deleted inserted replaced
5372:6c3a695f54f5 5374:d967d96ca043
347 a bad idea, and have separate character types. In XEmacs version 20, 347 a bad idea, and have separate character types. In XEmacs version 20,
348 the modern convention is followed, and characters are their own 348 the modern convention is followed, and characters are their own
349 primitive types. (This change was necessary in order for @sc{mule}, 349 primitive types. (This change was necessary in order for @sc{mule},
350 i.e. Asian-language, support to be correctly implemented.) 350 i.e. Asian-language, support to be correctly implemented.)
351 351
352 Even in XEmacs version 20, remnants of the equivalence between
353 characters and integers still exist; this is termed the @dfn{char-int
354 confoundance disease}. In particular, many functions such as @code{eq},
355 @code{equal}, and @code{memq} have equivalent functions (@code{old-eq},
356 @code{old-equal}, @code{old-memq}, etc.) that pretend like characters
357 are integers are the same. Byte code compiled under any version 19
358 Emacs will have all such functions mapped to their @code{old-} equivalents
359 when the byte code is read into XEmacs 20. This is to preserve
360 compatibility---Emacs 19 converts all constant characters to the equivalent
361 integer during byte-compilation, and thus there is no other way to preserve
362 byte-code compatibility even if the code has specifically been written
363 with the distinction between characters and integers in mind.
364
365 Every character has an equivalent integer, called the @dfn{character 352 Every character has an equivalent integer, called the @dfn{character
366 code}. For example, the character @kbd{A} is represented as the 353 code}. For example, the character @kbd{A} is represented as the
367 @w{integer 65}, following the standard @sc{ascii} representation of 354 @w{integer 65}, following the standard @sc{ascii} representation of
368 characters. If XEmacs was not compiled with @sc{mule} support, the 355 characters. If XEmacs was not compiled with @sc{mule} support, the
369 range of this integer will always be 0 to 255---eight bits, or one 356 range of this integer will always be 0 to 255---eight bits, or one
2315 @end group 2302 @end group
2316 @end example 2303 @end example
2317 2304
2318 @end defun 2305 @end defun
2319 2306
2320 @defun old-eq object1 object2
2321 This function exists under XEmacs 20 and is exactly like @code{eq}
2322 except that it suffers from the char-int confoundance disease.
2323 In other words, it returns @code{t} if given a character and the
2324 equivalent integer, even though the objects are of different types!
2325 You should @emph{not} ever call this function explicitly in your
2326 code. However, be aware that all calls to @code{eq} in byte code
2327 compiled under version 19 map to @code{old-eq} in XEmacs 20.
2328 (Likewise for @code{old-equal}, @code{old-memq}, @code{old-member},
2329 @code{old-assq} and @code{old-assoc}.)
2330
2331 @example
2332 @group
2333 ;; @r{Remember, this does not apply under XEmacs 19.}
2334 ?A
2335 @result{} ?A
2336 (char-int ?A)
2337 @result{} 65
2338 (old-eq ?A 65)
2339 @result{} t ; @r{Eek, we've been infected.}
2340 (eq ?A 65)
2341 @result{} nil ; @r{We are still healthy.}
2342 @end group
2343 @end example
2344 @end defun
2345
2346 @defun eql object1 object2 2307 @defun eql object1 object2
2347 2308
2348 This function returns @code{t} if the two arguments are the same object, 2309 This function returns @code{t} if the two arguments are the same object,
2349 as with @code{eq}. In addition, it returns @code{t} if @var{object1} 2310 as with @code{eq}. In addition, it returns @code{t} if @var{object1}
2350 and @var{object2} are numeric objects of the same type and with equal 2311 and @var{object2} are numeric objects of the same type and with equal