map(f, ::String)
requires f
to return an AbstractChar
#54580
Open
Description
As seen on discourse.
MWE:
julia> 'あ' |> UInt32
0x00003042
julia> map(UInt32, "あいうえお")
ERROR: ArgumentError: map(f, s::AbstractString) requires f to return AbstractChar; try map(f, collect(s)) or a comprehension instead
Stacktrace:
[1] map(f::Type{UInt32}, s::String)
@ Base ./strings/basic.jl:669
[2] top-level scope
@ REPL[5]:1
This should IMO return a Vector{UInt32}
instead. The original error was added in f08ba8d; the commit also has a comment already mentioning that it would be good not to be too restrictive here.