On Jan 15, 2018, at 11:01 PM, Xiaodi Wu via swift-evolution 
<swift-evolution@swift.org> wrote:
> - Can we change the semantics? Maybe, but I doubt ExpressibleByFloatLiteral 
> can be outright replaced. You're not the first to wonder about how to design 
> an alternative protocol. Dig through the archives and you'll find some 
> existing ideas. My two cents: The main alternative base in question here is 
> 10. However, decimal storage formats and binary storage formats share so 
> little in common that any initializer common to both will be extremely 
> unwieldy for one or both formats. Personally, somewhere down the road, I'd 
> rather see Decimal64/128 become standard library types (already working on 
> it), DecimalFloatingPoint become a standard library protocol, and `0.1` 
> become a "decimal literal" (with Float, Double, Float80, and Decimal64/128 
> all conforming) as distinct from a "float literal" that we could then 
> restrict to hexadecimal (?and binary) floating-point literals (and maybe 
> rename accordingly).

If we were motivated to fix this (and I’m not :-), then I think the best path 
forward would be to rename ExpressibleByFloatLiteral to something like 
ExpressibleByBinaryFloatLiteral.  This would allow the introduction of a new 
ExpressibleByDecimalFloatLiteral with a different initializer requirement.

I’m not motivated to fix this, because there is nothing actively broken by the 
current state of things.  With the current name we can still introduce a 
ExpressibleByDecimalFloatLiteral someday in the future.  The two names will be 
a little odd, but given the cost of changing it at this point, that seems 
perfectly acceptable.


swift-evolution mailing list

Reply via email to