Do symbols need to be EQ?

Edi Weitz edi at weitz.de
Fri Jul 3 08:36:00 UTC 2015


On Fri, Jul 3, 2015 at 10:14 AM, Anton Vodonosov <avodonosov at yandex.ru> wrote:
> This doesn't break my PRINT-VALUE function, because the contract
> of my function is not to print lower case value when MODE is a symbols
> named "MYPKG:LOWCASE", but when MODE is exactly the symbol referred to
> in PRINT-VALUE.

I think this is where we agree to disagree.  Suppose you had written
your function like so:

  (defun print-value (value mode)
    (if (eql mode 42)
      (format nil "~(~A~)" value)
      (format nil "~A" value)))

Would you expect someone to be able change the identity of the
constant 42 in your function in such a way that it would no longer
work if called as (PRINT-VALUE ... 42)?

Yes, there are different ways to represent 42 (as in binary, octal,
and so on), but unless you totally mess up the readtable, there's no
simple way to make it impossible to refer to 42 with a literal
anymore.



More information about the pro mailing list