[swift-evolution] Trial balloon: conforming sizeof, sizeofValue, etc. to naming guidelines

Dave Abrahams dabrahams at apple.com
Sun May 1 20:51:35 CDT 2016

on Sun May 01 2016, Xiaodi Wu <xiaodi.wu-AT-gmail.com> wrote:

> On Sun, May 1, 2016 at 7:01 PM, Dave Abrahams via swift-evolution
> <swift-evolution at swift.org> wrote:
>     on Sun May 01 2016, Xiaodi Wu <swift-evolution at swift.org> wrote:
>     > A clash of names is inelegant, but in practice, I'm not actually sure that
>     > there's really a lack of clarity. IMO, `stride(of: Int)` is not really
>     > misinterpretable as anything else.
>     I disagree, especially since `Strideable` has an associated `Stride` type.
> Is the naming infelicitous? Yes, no argument from me here.
> But: I'd guess that Strideable, being a protocol for numeric types, 

Not only those.  UnsafePointer is strideable, for example.

> comes into the picture mostly when implementing generic numeric
> algorithms, and its associated Stride type (if I remember correctly
> from reading code comments) should really be Distance but for current
> limitations in the language. 

I don't *think* so.

> I have no doubt that someone who knows the insides of Strideable to
> that level of detail has the expertise and imagination to conjure up a
> meaning for `stride(of: Int)` other than the stride size in bytes of
> consecutive Ints, but I venture that it'd still take some effort and
> wouldn't be an unintentional misunderstanding :P

You're going to see a definition of Int.Stride when you look at the members.


More information about the swift-evolution mailing list