[swift-evolution] [Proposal Draft] Literal Syntax Protocols
Erica Sadun
erica at ericasadun.com
Tue Jun 28 16:26:16 CDT 2016
> On Jun 28, 2016, at 2:57 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> No, it's exactly the opposite, as I keep saying. Conformance to this
> protocol does *not* mean you can initialize the type with a literal.
> Proof:
>
> func f<T: IntegerLiteralConvertible>() -> T {
> return T(integerLiteral: 43) // Error
> return T(43) // Also an Error
> }
>
> It means an instance of the type can be *written* as a literal:
>
> func f<T: IntegerLiteralConvertible>() -> T {
> return 43 // OK
> }
>
> Everybody's confused about the meaning of the protocol, and doesn't like
> the proposed names because they imply exactly the actual meaning of the
> protocol, which they misunderstand.
Or we're clueless AND it's a bad name.
func f<T: IntegerPromotion>() -> T {
return 42 // the answer to everything
}
-- E
More information about the swift-evolution
mailing list