Subject: Re: Pass by value
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 10 Feb 2009 18:50:32 -0600
Newsgroups: comp.lang.lisp
Message-ID: <6dydnaIyR8lFvQ_UnZ2dnUVZ_q7inZ2d@speakeasy.net>
Tobias C. Rittweiler <tcr@freebits.de.invalid> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
| > ... [Reminder: EQ *defines* "object identity".] ...
| 
| EQL does, for meaningful values of "object identity". :-)
+---------------

While I would not normally bicker about this sort of snipe, in
this case I really must insist that we stick to the CLHS here:

    Function EQ
    ...
    Description:
    Returns true if its arguments are the same, identical object;
    otherwise, returns false

    Function EQL
    ...
    Description:
    The value of EQL is true of two objects, x and y, in the
    following cases:
    1. If x and y are EQ.
    2. If x and y are both numbers of the same type and the same value.
    3. If they are both characters that represent the same character.
    Otherwise the value of EQL is false. 

In Common Lisp, EQ is the *only* meaningful value of "object identity".

What EQL measures is "(default) sameness", that is, "indistinguishable
by EQL (if no predicate is implied by context)", to paraphrase the CLHS
Glossary entry "Same(2)". As that entry continues:

    Since EQ is used only rarely in this specification, EQL is the
    default predicate when none is mentioned explicitly.

So to summarize:

EQ == "identical".
EQL == "same" (unless context overrides).

I don't think it could be much more clear than that.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607