[swift-evolution] Something lightweight to discuss: improvement to print(_:separator:terminator:) ?

Brandon Knope bknope at me.com
Fri Aug 5 11:09:36 CDT 2016


One thing about print that I find odd to look at is when you don't want to use a line break: 

print(someValue, terminator: "") 

What if we used an enum for these options, especially for the two most common ones?

enum PrintTerminatorTypes {
    case none
    case lineBreak //default
    case custom(String)
}

print(someValue, terminator: .none)
print(someValue, terminator: .lineBreak)
print(someValue, terminator: .custom(" --- "))

This seems clearer and more self documenting. 

Obviously this isn't a really important change but:
1. Swift-Evo seems light lately so why not discuss something...especially something really lightweight 
2. It's source breaking (...but it could be offered as an override?)

Brandon 

Sent from my iPad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160805/6e121c7f/attachment.html>


More information about the swift-evolution mailing list