[swift-build-dev] Should Version be StringLiteralConvertible?

Max Howell max.howell at apple.com
Mon Jan 4 13:22:00 CST 2016


Can you provide a use case that demonstrates the danger?

I can only imagine situations where the Package.swift is invalid and thus `swift build` simply errors out.  No data is lost, no work is lost. Just time.

> On Dec 30, 2015, at 1:16 PM, Ling Wang via swift-build-dev <swift-build-dev at swift.org> wrote:
> 
> Because Version.init?(_ characters:) is really failable this code is very dangerous:
> extension Version: StringLiteralConvertible {
>    public init(stringLiteral value: String) {
>        self.init(value.characters)!
>    }
> 
> Is the convenience worth it?
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev



More information about the swift-build-dev mailing list