Steel Bank Common Lisp

equal fails on symbol-names

Reported by George Vanecek on 2013-07-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

This seems like a bug in the equal function.
Given that

  (symbol-name 'abc) => "abc"
  (equal "abc" "abc") => t

why then do you get

  (equal (symbol-name 'abc) "abc") => nil

Why does this matter? cause I need to create a (make-hash-table :test 'equal) that can take keys that are either simple-strings or the symbol-names. Am I missing something or is this a bug in equal?

 status invalid
 done

George Vanecek <email address hidden> writes:

> Public bug reported:
>
> This seems like a bug in the equal function.
> Given that
>
> (symbol-name 'abc) => "abc"

Are you *sure* that this is a given? This code, as written, can never
produce the answer that you have stated.

> (equal "abc" "abc") => t
>
> why then do you get
>
> (equal (symbol-name 'abc) "abc") => nil

Under default reader conditions, (symbol-name 'abc) is "ABC". Under
other reader conditions, executing (symbol-name 'abc) either returns
"ABC" or signals an error about an undefined function |symbol-name|.

I'm closing this bug because I think that the most likely cause is
misunderstanding how the CL reader handles case. If I'm wrong, please
provide an exact code transcript showing the error.

Christophe

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers