[swift-evolution] Strings in Swift 4

Ben Cohen ben_cohen at apple.com
Fri Jan 20 10:19:49 CST 2017

> On Jan 20, 2017, at 8:04 AM, Ole Begemann <ole at oleb.net> wrote:
>> The downside of having two types is the inconvenience of sometimes having
>> a
>> `Substring` when you need a `String`, and vice-versa. It is likely this
>> would
>> be a significantly bigger problem than with `Array` and `ArraySlice`, as
>> slicing of `String` is such a common operation. It is especially relevant
>> to
>> existing code that assumes `String` is the currency type.
> I'm not familiar with the term "currency type" that appears several
> times in the document. Could you clarify what it means? Googling it
> proved difficult because all results are about the "money" meaning of
> "currency".

Yes, that is a bit jargony.

We mean it as in a “common currency” that everyone uses for exchange. That is, what everyone should use to pass strings around, between API boundaries etc. The goal is for people not to have to think “hmm, what kind of string type should I use here”. If you are not sure, String is always a reasonable default.

More information about the swift-evolution mailing list