equal fails on symbol-names

Bug #1200503 reported by George Vanecek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
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?

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 1200503] [NEW] equal fails on symbol-names

 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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.