There are many characters that have different Unicode values but use the
same glyphs. Many Cyrillic characters look like their English characters,
so they appear the same visually, but equal? and eq? reveal that they are
actually distinct. It seems to be that the BOM is just another example on
this sort of thing, and people will need to learn that they can't
necessarily trust their eyes.

#lang racket

(define cyrillic (string->symbol "\u0410\u0412\u0421"))
(define english (string->symbol "ABC"))
cyrillic
english
(equal? cyrillic english)
(eq? cyrillic english)

Welcome to DrRacket, version 6.9 [3m].
Language: racket, with debugging; memory limit: 128 MB.
'АВС
'ABC
#f
#f
>

Justin

On Wed, Dec 27, 2017 at 10:33 PM, Jay McCarthy <jay.mccar...@gmail.com>
wrote:

> Okay. I think I understand.
>
> The behavior of "two things print the same but are actually different"
> that Racket has seems to be the same as my editor and Web browser
> which don't render the BOM as anything unless I fiddle something in
> Emacs. Additionally, it seems painful to make it do it a different
> way.
>
> On Wed, Dec 27, 2017 at 10:26 PM, John Clements
> <cleme...@brinckerhoff.org> wrote:
> >
> >
> >> On Dec 27, 2017, at 19:06, Jay McCarthy <jay.mccar...@gmail.com> 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
> >> <racket-users@googlegroups.com> 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 racket-users+unsubscr...@googlegroups.com.
> >>> 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 racket-users+unsubscr...@googlegroups.com.
> >> 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 racket-users+unsubscr...@googlegroups.com.
> 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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to