(Interned) symbols that have the same printed form but are not equal to each other already exist tho; the symbols produced by string->unreadable-symbol are not equal? to their counterparts produced by the reader, but nevertheless have the same printed representation.
Shu-Hung On Wed, Dec 27, 2017 at 9:26 PM, 'John Clements' via Racket Users <[email protected]> wrote: > > >> On Dec 27, 2017, at 19:06, Jay McCarthy <[email protected]> wrote: >> >> This seems to be consistent with my Web browser and editor. Are the >> symbols eq? or equal? > > Neither. Am I misunderstanding you? Here’s code: > > #lang racket > > (define bad-symbol (string->symbol "\uFEFFhello")) > > (define regular-symbol 'hello) > > bad-symbol > regular-symbol > (equal? bad-symbol regular-symbol) > (eq? bad-symbol regular-symbol) > > this evaluates in DrR to: > > Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m]. > Language: racket, with debugging; memory limit: 4096 MB. > 'hello > 'hello > #f > #f >> > > If you copy and paste these from the interactions into the definitions > window, you can even get this: > > #lang racket > > (equal? 'hello 'hello) > (eq? 'hello ‘hello) > > evaluates to: > > Welcome to DrRacket, version 6.11.0.5--2017-12-20(-/f) [3m]. > Language: racket, with debugging; memory limit: 4096 MB. > #f > #f >> > > Did you misunderstand me, or did I misunderstand you? > > John > > > > > >> > >> On Wed, Dec 27, 2017 at 3:54 PM, 'John Clements' via Racket Users >> <[email protected]> wrote: >>> I was working with files containing a Byte Order Mark today, and in the >>> process of writing a test case, I discovered that >>> >>> (string->symbol “\uFEFF”) >>> >>> produces a symbol whose printed representation is >>> >>> ‘hello >>> >>> … which seems unfortunate; I guess I would have expected something like >>> >>> ‘|\uFEFFhello| >>> >>> (… although I see now that this kind of escaping is not currently enabled >>> inside vertical bars). >>> >>> This leads to situations where two symbols with the same printed >>> representation may not be equal?, which seems unfortunate. >>> >>> Am I overlooking a good reason why this is the desired behavior? >>> >>> John >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Racket Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> -=[ Jay McCarthy http://jeapostrophe.github.io ]=- >> -=[ Associate Professor PLT @ CS @ UMass Lowell ]=- >> -=[ Moses 1:33: And worlds without number have I created; ]=- >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

