[Pitch] String revision proposal #1


(Karim Nassar) #1

Message: 12
Date: Thu, 30 Mar 2017 12:23:13 +0200
From: Adrian Zubarev <adrian.zubarev@devandartist.com>
To: Ben Cohen <ben_cohen@apple.com>
Cc: swift-evolution@swift.org
Subject: Re: [swift-evolution] [Pitch] String revision proposal #1
Message-ID: <etPan.58dcdc91.583a4c4b.1af7@devandartist.com>
Content-Type: text/plain; charset="utf-8"

I haven’t followed the topic and while reading the proposal I found it a little confusing that we have inconsistent type names. I’m not a native English speaker so that’s might be the main case for my confusion here, so I’d appreciate for any clarification. :wink:

SubSequence vs. Substring and not SubString.

The word substring is an English word, but so is subsequence (I double checked here).

So where exactly is the issue here? Is it SubSequence which is written in camel case or is it Substring which is not?

--
Adrian Zubarev
Sent with Airmail

I’d also be curious if StringSlice was considered, since we have already the well-established and seemingly-parallel ArraySlice.

—Karim


(Ben Cohen) #2

Message: 12
Date: Thu, 30 Mar 2017 12:23:13 +0200
From: Adrian Zubarev <adrian.zubarev@devandartist.com>
To: Ben Cohen <ben_cohen@apple.com>
Cc: swift-evolution@swift.org
Subject: Re: [swift-evolution] [Pitch] String revision proposal #1
Message-ID: <etPan.58dcdc91.583a4c4b.1af7@devandartist.com>
Content-Type: text/plain; charset="utf-8"

I haven’t followed the topic and while reading the proposal I found it a little confusing that we have inconsistent type names. I’m not a native English speaker so that’s might be the main case for my confusion here, so I’d appreciate for any clarification. :wink:

SubSequence vs. Substring and not SubString.

The word substring is an English word, but so is subsequence (I double checked here).

So where exactly is the issue here? Is it SubSequence which is written in camel case or is it Substring which is not?

--
Adrian Zubarev
Sent with Airmail

I’d also be curious if StringSlice was considered, since we have already the well-established and seemingly-parallel ArraySlice.

Yup we considered it (I should probably have put it in the Alternatives Considered section). Also considered: having nothing but String.SubSequence. In fact it may be Substring is just a typealias for String.SubSequence, though this would be an implementation detail rather than part of the proposal.

The current hope (unrelated to String) is that ArraySlice could be eliminated, by introducing some kind of “ContiguouslyStored” protocol and then extending the general Slice when it slices something that conforms to that. But this can’t be done with Substring because of the small string optimization.

The other difference is there’s no common term of art for a slice of an Array, whereas there is for a slice of a String.

···

On Mar 30, 2017, at 10:05 AM, Karim Nassar via swift-evolution <swift-evolution@swift.org> wrote:

—Karim

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Karim Nassar) #3

Makes sense. Thanks for the explanation.

--Karim

···

On Mar 30, 2017, at 7:43 PM, Ben Cohen <ben_cohen@apple.com> wrote:

On Mar 30, 2017, at 10:05 AM, Karim Nassar via swift-evolution <swift-evolution@swift.org> wrote:

Message: 12
Date: Thu, 30 Mar 2017 12:23:13 +0200
From: Adrian Zubarev <adrian.zubarev@devandartist.com>
To: Ben Cohen <ben_cohen@apple.com>
Cc: swift-evolution@swift.org
Subject: Re: [swift-evolution] [Pitch] String revision proposal #1
Message-ID: <etPan.58dcdc91.583a4c4b.1af7@devandartist.com>
Content-Type: text/plain; charset="utf-8"

I haven’t followed the topic and while reading the proposal I found it a little confusing that we have inconsistent type names. I’m not a native English speaker so that’s might be the main case for my confusion here, so I’d appreciate for any clarification. :wink:

SubSequence vs. Substring and not SubString.

The word substring is an English word, but so is subsequence (I double checked here).

So where exactly is the issue here? Is it SubSequence which is written in camel case or is it Substring which is not?

--
Adrian Zubarev
Sent with Airmail

I’d also be curious if StringSlice was considered, since we have already the well-established and seemingly-parallel ArraySlice.

Yup we considered it (I should probably have put it in the Alternatives Considered section). Also considered: having nothing but String.SubSequence. In fact it may be Substring is just a typealias for String.SubSequence, though this would be an implementation detail rather than part of the proposal.

The current hope (unrelated to String) is that ArraySlice could be eliminated, by introducing some kind of “ContiguouslyStored” protocol and then extending the general Slice when it slices something that conforms to that. But this can’t be done with Substring because of the small string optimization.

The other difference is there’s no common term of art for a slice of an Array, whereas there is for a slice of a String.

—Karim

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution