*Note: *Unlike String.Chars.to_string/1, Kernel.inspect/1 is allowed to 
take liberties. Consequently, it can provide string representations of all 
types.

On Friday, December 2, 2016 at 9:39:44 AM UTC-5, Bryan Enders wrote:
>
> String.Chars.to_string/1 is only implemented by default for types that 
> can be represented with unambiguous precision… with the exception of Float. 
> The ambiguity with regards to representing tuples and maps (and by 
> extension structs) would seem to be the primary reason for omitting a 
> default implementation for those types. The same could be said of floats. A 
> programmer attempting to interpolate 1_000.0 into a string might be quite 
> surprised to discover that the string representation is "1.0e3". They 
> might be even more surprised to discover that interpolating 
> 12_123_123_123_123_123_123.0 will be rounded in its representation as 
> "1.2123123123123122e19". The protocol implementation must make formatting 
> assumptions with regards to precision when it comes to floats. I would 
> recommend the eventual deprecation of the default String.Chars implementation 
> for Float.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/d31d676e-063f-43e4-bd73-db609451df2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to