Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Haravikk via swift-evolution
> On 28 May 2016, at 20:16, Xiaodi Wu wrote: > > I couldn't disagree more. Generic programming is a far more advanced concept > than arrays and dictionaries, and learners should be able to use them without > contending with angle brackets they don't understand. > > Fundamentally, even for an

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On May 28, 2016, at 1:38 PM, Haravikk via swift-evolution > wrote: > > >> On 27 May 2016, at 15:31, plx via swift-evolution >> wrote: >> >> protocol Sequence { >> typealias of == S: Self where S.Iterator.Element == E >> } >> >> // sequence-accepting variant

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On May 28, 2016, at 12:40 PM, Thorsten Seitz wrote: > > >>> Am 27.05.2016 um 20:47 schrieb Matthew Johnson via swift-evolution >>> : >>> >>> On May 27, 2016, at 12:05 PM, Charles Srstka via swift-evolution wrote: On May 27, 2016, at 9:31 AM, plx v

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Xiaodi Wu via swift-evolution
I couldn't disagree more. Generic programming is a far more advanced concept than arrays and dictionaries, and learners should be able to use them without contending with angle brackets they don't understand. Fundamentally, even for an experienced user of the language, working with Collections and

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Haravikk via swift-evolution
> On 27 May 2016, at 15:31, plx via swift-evolution > wrote: > > protocol Sequence { > typealias of == S: Self where S.Iterator.Element == E > } > > // sequence-accepting variant > func doSomething>(values: S) { … } This is a nice alternative; would it actually need to be declared

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-28 Thread Thorsten Seitz via swift-evolution
> Am 27.05.2016 um 20:47 schrieb Matthew Johnson via swift-evolution > : > > >> On May 27, 2016, at 12:05 PM, Charles Srstka via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >>> On May 27, 2016, at 9:31 AM, plx via swift-evolution >>> mailto:swift-evolution@swift.org>> wro

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On May 27, 2016, at 3:43 PM, Dave Abrahams via swift-evolution > wrote: > > > On May 24, 2016, at 9:35 PM > > on Tue May 24 2016, Matthew Johnson wrote: > >> , Austin Zheng >> wrote: >> >>On Tue, May 24, 2016 at 4:24 PM, Brent Royal-Gordon >> wrote: >> >>> I

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Dave Abrahams via swift-evolution
On May 24, 2016, at 9:35 PM on Tue May 24 2016, Matthew Johnson wrote: > , Austin Zheng > wrote: > > On Tue, May 24, 2016 at 4:24 PM, Brent Royal-Gordon > wrote: > > > I’m not sure what you mean about introducing type unsafely. > > What I mean is that once you do this: > >

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Charles Srstka via swift-evolution
> On May 27, 2016, at 1:53 PM, Xiaodi Wu wrote: > > Firstly, the syntax is about to get a lot cleaner. Soon, your example will be: > > func doSomething< > S: Sequence, T: Sequence, U: Sequence > >(foos: S, bars: T, bazzes: U) > where S.Element == Foo, T.Element == Bar, U.Element == Baz I wonder

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Dave Abrahams via swift-evolution
on Fri May 27 2016, Xiaodi Wu wrote: > Firstly, the syntax is about to get a lot cleaner. Soon, your example will be: > > func doSomething< > S: Sequence, T: Sequence, U: Sequence >>(foos: S, bars: T, bazzes: U) > where S.Element == Foo, T.Element == Bar, U.Element == Baz > > Second, this syntax

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Xiaodi Wu via swift-evolution
Firstly, the syntax is about to get a lot cleaner. Soon, your example will be: func doSomething< S: Sequence, T: Sequence, U: Sequence >(foos: S, bars: T, bazzes: U) where S.Element == Foo, T.Element == Bar, U.Element == Baz Second, this syntax shows necessary complexity. Case in point: an array

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Matthew Johnson via swift-evolution
> On May 27, 2016, at 12:05 PM, Charles Srstka via swift-evolution > wrote: > >> On May 27, 2016, at 9:31 AM, plx via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> For the Sequence/Collection it’s a lot of work for IMHO a rather minor >> convenience, but for more-complex

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread Charles Srstka via swift-evolution
> On May 27, 2016, at 9:31 AM, plx via swift-evolution > wrote: > > For the Sequence/Collection it’s a lot of work for IMHO a rather minor > convenience, but for more-complex type associated-type relationships it could > start to pay its own way. Is it really that minor, though? For something

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-27 Thread plx via swift-evolution
Late response! As-specified, although I understand the *motivation* for this suggestion, I can’t support the specific proposal whatsoever. That said, I do think there’d be a lot of value in a way to add “convenience type predicates” (terrible name, please improve!) to declarations, so that e.g.

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On May 24, 2016, at 9:35 PM, Austin Zheng wrote: > > > >> On Tue, May 24, 2016 at 4:24 PM, Brent Royal-Gordon >> wrote: >> > I’m not sure what you mean about introducing type unsafely. >> >> What I mean is that once you do this: >> >> let x: AnyCollection = my

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Austin Zheng via swift-evolution
On Tue, May 24, 2016 at 4:24 PM, Brent Royal-Gordon wrote: > > I’m not sure what you mean about introducing type unsafely. > > What I mean is that once you do this: > > let x: AnyCollection = myArrayOfCharacters > let y: AnyCollection = myString.characters > > Both `x` and `y` hav

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Austin Zheng via swift-evolution
Sorry. That sentence should read: [Foo] is an array. Collection means nothing in Swift right now, but it really does look awfully like a generic protocol by analogy. Since I'm here, I might as well keep on digging... Right now, we have good syntax delineation. Generic types and functions are imme

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Austin Zheng via swift-evolution
I regret mentioning existentials; I am aware that an existential that isn't sufficiently constrained will never be able to provide the same guarantees as a generic type variable. My argument is that even a partially constrained existential is useful if there is a useful set of APIs that don't touch

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Matthew Johnson via swift-evolution
> On May 24, 2016, at 6:24 PM, Brent Royal-Gordon > wrote: > >> I’m not sure what you mean about introducing type unsafely. > > What I mean is that once you do this: > > let x: AnyCollection = myArrayOfCharacters > let y: AnyCollection = myString.characters > > Both `x` and `y` h

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Charles Srstka via swift-evolution
> On May 24, 2016, at 5:45 PM, Haravikk via swift-evolution > wrote: > >> On 24 May 2016, at 21:14, Leonardo Pessoa > > wrote: >> >> My first question here would be "what's the gain?" I understand >> CollectionTypes and arrays may be something different but I myself >>

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Brent Royal-Gordon via swift-evolution
> I’m not sure what you mean about introducing type unsafely. What I mean is that once you do this: let x: AnyCollection = myArrayOfCharacters let y: AnyCollection = myString.characters Both `x` and `y` have indices of type `Any`, and will now accept each others' indices:

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Matthew Johnson via swift-evolution
> On May 24, 2016, at 5:55 PM, Brent Royal-Gordon via swift-evolution > wrote: > >> Better support for existentials (see the generics manifesto, >> https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md) should >> obviate the need for any sort of sugar or compiler magic to do th

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Matthew Johnson via swift-evolution
> On May 24, 2016, at 5:45 PM, Haravikk via swift-evolution > wrote: > > >> On 24 May 2016, at 21:14, Leonardo Pessoa > > wrote: >> >> My first question here would be "what's the gain?" I understand >> CollectionTypes and arrays may be something different but I mysel

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Brent Royal-Gordon via swift-evolution
> Better support for existentials (see the generics manifesto, > https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md) should > obviate the need for any sort of sugar or compiler magic to do this kind of > thing. > > typealias AnyCollection = Any > func doSomething(collection: A

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Haravikk via swift-evolution
> On 24 May 2016, at 21:14, Leonardo Pessoa wrote: > > My first question here would be "what's the gain?" I understand > CollectionTypes and arrays may be something different but I myself > admit I don't know and wonder how that change would be a benefit to > us? Instead of functions only accep

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread T.J. Usiyan via swift-evolution
"that [Foo], when used in a function, should produce the latter form behind the scenes, requiring the developer to specify Array if they actually need it to be an Array for some reason." I disagree with this as a solution. I agree that Sequence or Collection is what is more often 'meant' but what

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Austin Zheng via swift-evolution
Better support for existentials (see the generics manifesto, https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md) should obviate the need for any sort of sugar or compiler magic to do this kind of thing. typealias AnyCollection = Any func doSomething(collection: AnyCollection) Au

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Leonardo Pessoa via swift-evolution
My first question here would be "what's the gain?" I understand CollectionTypes and arrays may be something different but I myself admit I don't know and wonder how that change would be a benefit to us? On 24 May 2016 at 14:57, Haravikk via swift-evolution wrote: > One thing that I see a lot in c

Re: [swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread David Hart via swift-evolution
I don’t see much usefulness in this shorthand. > On 24 May 2016, at 19:57, Haravikk via swift-evolution > wrote: > > One thing that I see a lot in code, and sometimes have to stop myself from > doing, is using shorthand array types, such as [Foo], in function > declarations where CollectionTy

[swift-evolution] [Pre-proposal] Replace [Foo] With CollectionType

2016-05-24 Thread Haravikk via swift-evolution
One thing that I see a lot in code, and sometimes have to stop myself from doing, is using shorthand array types, such as [Foo], in function declarations where CollectionType could just as easily be used. For example, the following two declarations can take collections of values, but the first w