Search code examples
emacslispelisp

What's the meaning of `indistinguishable` in Emacs Lisp?


I was reading the documentation of an Emacs Lisp function called eql:

Return t if the two args are eq or are indistinguishable numbers.

What's the meaning of indistinguishable here? I'd been searching through the documentation but didn't find an explanation.


Solution

  • The eq predicate returns t only when comparing identical objects. But two values which compare equal are not guaranteed to be the same object; two literals with the same value are not even guaranteed to be the same object. So, (eq 1 1) may or may not evaluate to t. For number types eql compares values, so that (eql 1 1) will always evaluate to t. But, eql is a bit more subtle: (eql 1 1.0) will evaluate to 'nil since 1 and 1.0 are not indistinguishable, i.e., they do not share the same type. So, in the context of the quote, indistinguishable means that the operands have the same type and the same value.