Currently `Enum.join/2` is using `IO.iodata_to_binary/1` internally to join 
output string. My proposal there is to change that to use 
`:unicode.chardata_to_binary/1` instead, which will allow this function to 
conform to specs. Because currently if we have code like:

    s = Enum.join([<<255>>, <<255>>])

It will output binary that is not string (`String.valid?(s) == false`). With 
`:unicode.chardata_to_binary/1` we could conform to the docs, but it would 
impose some performance hit, because of additional traverse to check if all 
binaries are properly UTF-8 encoded.

So before proposing PR with that change I wanted to consult there - what is 
more expected, correction of the specs (so it would accept any binary and will 
output binary) or it should be changed to check if the resulting binary is 
`String.t()`?

--

Łukasz Niemier
luk...@niemier.pl

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/C5E0B65F-3373-4980-A04D-351E0EFAEB8D%40niemier.pl.

Reply via email to