Trial balloon: conforming sizeof, sizeofValue, etc. to naming guidelines


(Anton Zhilin) #1

Then why not rename stride(from:to:by:) to range(from:to:by:) ?
I think, range is closer to what people coming from other languages expect
to see.

- Anton

···

With the renaming proposed above, stride(of:) will appear to be related
to stride(from:to:by:). This conflict arises from a pre-existing issue;
namely, the term "stride" is used to mean two different things. Although
moving the preposition only highlights the issue, one possible resolution
is to rename strideof(_:slight_smile: to strideSize(of:) and strideofValue(_:slight_smile:
tostrideSize(ofValue:).
I wonder if it might make sense to rename all of these, then?
instanceSize(of:)
instanceSize(ofValue:)
alignmentSize(of:)
alignmentSize(ofValue:)
strideSize(of:)
strideSize(ofValue:)
--
Brent Royal-Gordon
Architechies


(Xiaodi Wu) #2

I think I agree with you that stride(from:to:by:) is the better candidate
for renaming. But, ranges and strides are distinct in Swift, and I don't
think we want to confuse the two, especially since ranges and intervals are
already being merged. A few of us have some ideas about striding over
things, which I hope we'll discuss soon :slight_smile: Out of scope for this proposal,
clearly.

···

On Sun, May 1, 2016 at 11:29 Антон Жилин <antonyzhilin@gmail.com> wrote:

Then why not rename stride(from:to:by:) to range(from:to:by:) ?
I think, range is closer to what people coming from other languages expect
to see.

- Anton

> With the renaming proposed above, stride(of:) will appear to be related

to stride(from:to:by:). This conflict arises from a pre-existing issue;
namely, the term "stride" is used to mean two different things. Although
moving the preposition only highlights the issue, one possible resolution
is to rename strideof(_:slight_smile: to strideSize(of:) and strideofValue(_:slight_smile:
tostrideSize(ofValue:).
I wonder if it might make sense to rename all of these, then?
instanceSize(of:)
instanceSize(ofValue:)
alignmentSize(of:)
alignmentSize(ofValue:)
strideSize(of:)
strideSize(ofValue:)

--
Brent Royal-Gordon
Architechies


(Dave Abrahams) #3

The main reason is that it doesn't produce a Range. “Range” already has
a meaning in Swift, and it ain't that.

···

on Sun May 01 2016, Антон Жилин <swift-evolution@swift.org> wrote:

Then why not rename stride(from:to:by:) to range(from:to:by:) ?
I think, range is closer to what people coming from other languages expect to
see.

--
Dave