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

2016-05-02 Thread Xiaodi Wu via swift-evolution
On Mon, May 2, 2016 at 4:32 PM, Chris Lattner via swift-evolution < swift-evolution@swift.org> wrote: > On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution < > swift-evolution@swift.org> wrote: > >>> > >>> I'd rather have > >>> > >>> MemoryLayout.size > >>> MemoryLayout.alignment > >>> M

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

2016-05-02 Thread Chris Lattner via swift-evolution
On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution wrote: >>> >>> I'd rather have >>> >>> MemoryLayout.size >>> MemoryLayout.alignment >>> MemoryLayout.spacing >> >> This would be a legit use for 'extension Any'. IMO it'd be even better >> as just T.size, T.alignment, T.spacing. >

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

2016-05-02 Thread Dave Abrahams via swift-evolution
on Mon May 02 2016, Joe Groff wrote: >> On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution >> wrote: >> >> >> on Mon May 02 2016, Joe Groff wrote: >> > On May 2, 2016, at 9:46 AM, Dave Abrahams via swift-evolution wrote: on Sun May 01 2016, Xiaodi Wu

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

2016-05-02 Thread Xiaodi Wu via swift-evolution
Well, I mean, it's not as though you invented them just for Swift. It's possible to evaluate sizeof an instance in C, C++, C#, D, Python, Rust... Removing this facility from Swift is a whole nother discussion from renaming. On Mon, May 2, 2016 at 3:11 PM, Dave Abrahams via swift-evolution < swift

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

2016-05-02 Thread Joe Groff via swift-evolution
> On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution > wrote: > > > on Mon May 02 2016, Joe Groff wrote: > >>> On May 2, 2016, at 9:46 AM, Dave Abrahams via swift-evolution >>> wrote: >>> >>> >>> on Sun May 01 2016, Xiaodi Wu wrote: >>> >> It's a bad habit of mine, I g

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

2016-05-02 Thread Jose Cheyo Jimenez via swift-evolution
I agree that the names could be more specific but I do agree that putting these methods on `Any` is a good idea. (I am not saying that `Any` should be open to user extensions though.) > On May 2, 2016, at 1:10 PM, Dave Abrahams via swift-evolution > wrote: > > > on Mon May 02 2016, Joe Grof

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

2016-05-02 Thread Dave Abrahams via swift-evolution
on Mon May 02 2016, Xiaodi Wu wrote: > I like it, but how do you accommodate sizeofValue, etc? IMO you don't. I added those years ago on a whim, when whims were what we had to guide development. I'm unconvinced they add value to Swift. > > > On Mon, May 2, 2016 at 11:46 Dave Abrahams > wrot

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

2016-05-02 Thread Dave Abrahams via swift-evolution
on Mon May 02 2016, Joe Groff wrote: >> On May 2, 2016, at 9:46 AM, Dave Abrahams via swift-evolution >> wrote: >> >> >> on Sun May 01 2016, Xiaodi Wu wrote: >> > >>> It's a bad habit of mine, I guess, to err on the side of suggesting >>> conservative >>> changes on the assumption that it

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

2016-05-02 Thread Joe Groff via swift-evolution
> On May 2, 2016, at 9:46 AM, Dave Abrahams via swift-evolution > wrote: > > > on Sun May 01 2016, Xiaodi Wu wrote: > >> It's a bad habit of mine, I guess, to err on the side of suggesting >> conservative >> changes on the assumption that it'll be maximally acceptable. If there's >> appetit

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

2016-05-02 Thread Xiaodi Wu via swift-evolution
I like it, but how do you accommodate sizeofValue, etc? On Mon, May 2, 2016 at 11:46 Dave Abrahams wrote: > > on Sun May 01 2016, Xiaodi Wu wrote: > > > It's a bad habit of mine, I guess, to err on the side of suggesting > conservative > > changes on the assumption that it'll be maximally accept

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

2016-05-02 Thread Dave Abrahams via swift-evolution
on Sun May 01 2016, Xiaodi Wu wrote: > It's a bad habit of mine, I guess, to err on the side of suggesting > conservative > changes on the assumption that it'll be maximally acceptable. If there's > appetite for a more serious renaming, and as you say these are considered > relatively rarely us

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

2016-05-02 Thread Joe Groff via swift-evolution
> On May 1, 2016, at 7:40 PM, Dave Abrahams via swift-evolution > wrote: > > The specific meaning of sizeof in Swift comes from either LLVM or from > SIL, IIRC. It predates me, but it's supposed to correspond to what the > IRGen level of the compiler calls “sizeof.” LLVM doesn't call anything

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
It's a bad habit of mine, I guess, to err on the side of suggesting conservative changes on the assumption that it'll be maximally acceptable. If there's appetite for a more serious renaming, and as you say these are considered relatively rarely used, then it's a world of possibility! We could do

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

2016-05-01 Thread Dave Abrahams via swift-evolution
on Sun May 01 2016, Антон Жилин 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. The main reason is that it doesn't produce a Range. “Range” already has a meaning in Swift, and it ain

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

2016-05-01 Thread Dave Abrahams via swift-evolution
on Sun May 01 2016, Xiaodi Wu wrote: > On Sun, May 1, 2016 at 7:00 PM, Dave Abrahams via swift-evolution > wrote: > > on Thu Apr 28 2016, Xiaodi Wu > wrote: > > > We all know and love sizeof(), but given that it's different from its C > > counterpart anyway, shouldn't these con

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
See: // FIXME(ABI)(compiler limitation): We'd like to name this type "Distance" // but for On Sun, May 1, 2016 at 20:51 Dave Abrahams wrote: > > on Sun May 01 2016, Xiaodi Wu wrote: > > > On Sun, May 1, 2016 at 7:01 PM, Dave Abrahams via swift-evolution > > wrote: > > > > on Sun May 01 20

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

2016-05-01 Thread Dave Abrahams via swift-evolution
on Sun May 01 2016, Xiaodi Wu wrote: > On Sun, May 1, 2016 at 7:01 PM, Dave Abrahams via swift-evolution > wrote: > > on Sun May 01 2016, Xiaodi Wu wrote: > > > A clash of names is inelegant, but in practice, I'm not actually sure > that > > there's really a lack of clarity. IMO,

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
On Sun, May 1, 2016 at 7:01 PM, Dave Abrahams via swift-evolution < swift-evolution@swift.org> wrote: > > on Sun May 01 2016, Xiaodi Wu 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 rea

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
On Sun, May 1, 2016 at 7:00 PM, Dave Abrahams via swift-evolution < swift-evolution@swift.org> wrote: > > on Thu Apr 28 2016, Xiaodi Wu wrote: > > > We all know and love sizeof(), but given that it's different from its C > > counterpart anyway, shouldn't these conform to Swift naming guidelines?

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

2016-05-01 Thread Dave Abrahams via swift-evolution
on Sun May 01 2016, Xiaodi Wu 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` ty

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

2016-05-01 Thread Dave Abrahams via swift-evolution
on Thu Apr 28 2016, Xiaodi Wu wrote: > We all know and love sizeof(), but given that it's different from its C > counterpart anyway, shouldn't these conform to Swift naming guidelines? In > other > words, after SE-0006, shouldn't these names be as follows? > > ``` > size(of: T.Type) > size(ofVa

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
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. On Sun, May 1, 2016 at 12:08 PM, Shawn Erickson wrote: > I personally kinda want to see these namespaced instead o

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

2016-05-01 Thread Shawn Erickson via swift-evolution
I personally kinda want to see these namespaced instead of global functions. That could possibly allow clarity in naming. -Shawn On Sun, May 1, 2016 at 2:55 AM Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > > With the renaming proposed above, stride(of:) will appea

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
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

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

2016-05-01 Thread Антон Жилин via swift-evolution
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 i

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

2016-05-01 Thread Xiaodi Wu via swift-evolution
On Sun, May 1, 2016 at 4:54 AM, Brent Royal-Gordon wrote: > > 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 p

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

2016-05-01 Thread Brent Royal-Gordon via swift-evolution
> 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 resoluti

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

2016-04-29 Thread Xiaodi Wu via swift-evolution
On Thu, Apr 28, 2016 at 3:55 PM, Josh Parmenter via swift-evolution < swift-evolution@swift.org> wrote: > I think this is a nice suggestion as well. > Best, > Josh > > On Apr 28, 2016, at 1:52 PM, Joe Groff via swift-evolution < > swift-evolution@swift.org> wrote:

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

2016-04-28 Thread Josh Parmenter via swift-evolution
I think this is a nice suggestion as well. Best, Josh On Apr 28, 2016, at 1:52 PM, Joe Groff via swift-evolution mailto:swift-evolution@swift.org>> wrote: On Apr 28, 2016, at 11:44 AM, Xiaodi Wu via swift-evolution mailto:swift-evolution@swift.org>> wrote: We all know and love sizeof(), but g

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

2016-04-28 Thread Joe Groff via swift-evolution
> On Apr 28, 2016, at 11:44 AM, Xiaodi Wu via swift-evolution > wrote: > > We all know and love sizeof(), but given that it's different from its C > counterpart anyway, shouldn't these conform to Swift naming guidelines? In > other words, after SE-0006, shouldn't these names be as follows? >

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

2016-04-28 Thread Xiaodi Wu via swift-evolution
We all know and love sizeof(), but given that it's different from its C counterpart anyway, shouldn't these conform to Swift naming guidelines? In other words, after SE-0006, shouldn't these names be as follows? ``` size(of: T.Type) size(ofValue: T) stride(of: T.Type) stride(ofValue: T) align(of: