Skip to content

eval(Meta.parse(repr(x))) != x for some Symbols #60429

@mhauru

Description

@mhauru

As an offshoot of #60428, I noticed that there are a lot of one-character Symbols whose repr does not parse back as the same Symbol:

julia> for i in 0:typemax(UInt32)
           c = nothing
           try
               c = Char(i)
               sym = Symbol(c)
           catch e
               continue
           end
           pass = (eval(Meta.parse(repr(sym))) == sym)
           if !pass
               println("fail: Char($i) ($(repr(c)))")
           end
       end
fail: Char(181) ('µ')
fail: Char(183) ('·')
fail: Char(603) ('ɛ')
fail: Char(884) ('ʹ')
fail: Char(903) ('·')
fail: Char(2392) ('')
fail: Char(2393) ('')
fail: Char(2394) ('')
fail: Char(2395) ('')
fail: Char(2396) ('')
fail: Char(2397) ('')
fail: Char(2398) ('')
fail: Char(2399) ('')
fail: Char(2524) ('')
fail: Char(2525) ('')
fail: Char(2527) ('')
fail: Char(2611) ('')
fail: Char(2614) ('')
fail: Char(2649) ('')
fail: Char(2650) ('')
fail: Char(2651) ('')
fail: Char(2654) ('')
fail: Char(2908) ('')
a
n
d

m
a
n
y

m
a
n
y

m
o
r
e

This seems quite contrary to spirit of what show should do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unicodeRelated to unicode characters and encodings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions