[swift-evolution] [Proposal Draft] Literal Syntax Protocols

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Jun 24 10:01:34 CDT 2016


I don’t like an underscore on public protocols. If we’re not forced to use the proposed syntax at all it looks strange when you use a type with an underscore (which to me represents something for private or internal usage).

In Swift we only can use literals for a single direction literal -> type, so why don’t we just rename the protocols to look like:

public protocol NilLiteralProtocol { ... }
public protocol BooleanLiteralProtocol { ... }
public protocol FloatLiteralProtocol { ... }
public protocol IntegerLiteralProtocol { ... }
public protocol UnicodeScalarLiteralProtocol { ... }
public protocol ExtendedGraphemeClusterProtocol { ... }
public protocol StringLiteralLiteralProtocol { ... }
public protocol StringInterpolationLiteralProtocol { ... }
public protocol ArrayLiteralProtocol { ... }
public protocol DictionaryLiteralProtocol { ... }
Here Protocol corresponds to the user that we’re about to access a specific literal with our type which implements the protocol. (Just like ErrorProtocol.)
- extension Array : ArrayLiteralConvertible
+ extension Array : ArrayLiteralProtocol


-- 
Adrian Zubarev
Sent with Airmail

Am 24. Juni 2016 um 16:21:21, Vladimir.S via swift-evolution (swift-evolution at swift.org) schrieb:

es are
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160624/008b26bc/attachment.html>


More information about the swift-evolution mailing list