Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-12 Thread Haravikk via swift-evolution
> On 12 Mar 2017, at 04:33, Ricardo Parada via swift-evolution > wrote: > > I read Haravikk's proposal a second time. I think I see the advantage of > being able to use it with other types besides array. > > I also found disambiguating with the trailing comma to

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-11 Thread Ricardo Parada via swift-evolution
I read Haravikk's proposal a second time. I think I see the advantage of being able to use it with other types besides array. I also found disambiguating with the trailing comma to be intuitive. On the other hand I did not find it so intuitive to use @variadic and @nonVariadic to

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-11 Thread Tino Heth via swift-evolution
> I'd find it fantastic if they added > > var list: String... = 1, 2,3,4,5 If this list taught me anything, that it is that there is an incredible diversity what people like or dislike ;-) But would you really prefer that (wait a moment: String??? ;-) over var list: [Int] = 1, 2, 3 or boring

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-11 Thread Derrick Ho via swift-evolution
I'd find it fantastic if they added var list: String... = 1, 2,3,4,5 However if they remove Variadic arguments then apple would need to remove it from their apis. To name a few... print NSPredicate(format:) UIAlertView Removing variadic arguments would be a breaking change though. They would

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-11 Thread Tino Heth via swift-evolution
>>> foo(["a", "b", "c"] as String...) >> >> I like this > > +1 I really don't get this: We have methods like NSLayoutConstraint.activate(_ constraints: [NSLayoutConstraint]), which works with an array, declares its parameter to be array and is called with an array. Quite simple. On the

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-09 Thread Jose Cheyo Jimenez via swift-evolution
> On Mar 9, 2017, at 10:43 AM, Ricardo Parada wrote: > > In other languages I normally have a method with a variable number of > arguments and another one taking an array. Then one typically ends up calling > the other. > > If we had implicit splatting I imagine it would

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-09 Thread Ricardo Parada via swift-evolution
In other languages I normally have a method with a variable number of arguments and another one taking an array. Then one typically ends up calling the other. If we had implicit splatting I imagine it would reduce such methods to only one. However if implicit splatting were to cause problems

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-09 Thread Ricardo Parada via swift-evolution
> On Feb 26, 2017, at 10:00 PM, Derrick Ho via swift-evolution > wrote: > > foo(["a", "b", "c"] as String...) I like this ___ swift-evolution mailing list swift-evolution@swift.org

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-09 Thread Rudolf Adamkovič via swift-evolution
That’s correct, thanks for the correction. The rule only applies to parameters with argument labels. But still, we’d lost this guarantee of self-documenting, type-safe non-emptiness if arbitrary arrays can be passed to variadic parameters with argument labels. R+ > On 8 Mar 2017, at 23:42,

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-08 Thread Derrick Ho via swift-evolution
Rudolf, I don't believe that is a rule. One example includes NSLog() In which the first parameter is a format string and the second is a variadic argument. The second one can be omitted. On Wed, Mar 8, 2017 at 5:09 PM Rudolf Adamkovič via swift-evolution < swift-evolution@swift.org> wrote: >

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-03-08 Thread Rudolf Adamkovič via swift-evolution
Correct me if I’m wrong but a variadic argument is guaranteed to have one or more elements in the array. Isn’t that the case? As an example, consider the following initializer: public init(state: State, actions: Action...) { // ... } Here, I can count on actions to be a

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-27 Thread Jose Cheyo Jimenez via swift-evolution
> On Feb 27, 2017, at 1:20 PM, Tino Heth <2...@gmx.de> wrote: > >> These is very unfortunate as a solution for “spreading” a collection or >> tuple so that It can be applied to function taking a variadic. >> It makes sense on the declaration site but not on the call site. >> >>

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-27 Thread Tino Heth via swift-evolution
> These is very unfortunate as a solution for “spreading” a collection or tuple > so that It can be applied to function taking a variadic. > It makes sense on the declaration site but not on the call site. > > someFunc(@nonVariadic [1]) > someFunc(@variadic [1]) > > There is nothing special

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-27 Thread Haravikk via swift-evolution
> On 27 Feb 2017, at 19:09, Jose Cheyo Jimenez wrote: > >> >> On Feb 27, 2017, at 9:59 AM, Haravikk > > wrote: >> >> >>> On 27 Feb 2017, at 17:10, Jose Cheyo Jimenez via swift-evolution >>>

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-27 Thread Haravikk via swift-evolution
> On 27 Feb 2017, at 17:10, Jose Cheyo Jimenez via swift-evolution > wrote: > On Feb 26, 2017, at 9:25 AM, Tino Heth via swift-evolution > > wrote: > >> I suggest to take a look at the topics "Variadics as

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-27 Thread Jose Cheyo Jimenez via swift-evolution
> On Feb 26, 2017, at 9:25 AM, Tino Heth via swift-evolution > wrote: > > I suggest to take a look at the topics "Variadics as an Attribute" and "array > splatting for variadic parameters" and >

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Dimitri Racordon via swift-evolution
> IMHO, it's a more elegant solution to the same problem. I might be worth > pursuing it despite the breaking change because it has more chance of being > considered than pure syntactic sugar which the core team is not even > considering before Swift 4. Besides, if I understood correctly I

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread David Hart via swift-evolution
> On 26 Feb 2017, at 19:17, Derrick Ho via swift-evolution > wrote: > > That is an interesting solution. Haravikk's solution was a breaking change > so it undoubtedly had resistance. IMHO, it's a more elegant solution to the same problem. I might be worth

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Dimitri Racordon via swift-evolution
I was also in favour of using an ellipsis operator to “unsplat” (to borrow the term in some other languages) an array into variadic parameters. However, after taking a look at Haravikk’s proposal [1] I think I would oppose using ellipsis for that purpose. The main advantage I see is that this

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Derrick Ho via swift-evolution
Well, I have found these discussions... It was marked as a bug and then directed to swift evolution . @jose, the prefix

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Jose Cheyo Jimenez via swift-evolution
> On Feb 26, 2017, at 8:26 AM, Derrick Ho via swift-evolution > wrote: > > In swift, a variadic argument can become an array without too much effort. > > func foo(_ va: String...) { >let a: [String] = va > } > > However, it seems odd to me that an array can not

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Derrick Ho via swift-evolution
That is an interesting solution. Haravikk's solution was a breaking change so it undoubtedly had resistance. If we were to merely allow Arrays to be cast as type String... then there were be nothing to break. String... is technically not a real type though, so when you use it anywhere outside

Re: [swift-evolution] [pitch] Variadic Arguments should accept Arrays

2017-02-26 Thread Tino Heth via swift-evolution
I suggest to take a look at the topics "Variadics as an Attribute" and "array splatting for variadic parameters" and https://github.com/Haravikk/swift-evolution/blob/a13dc03d6a8c76b25a30710d70cbadc1eb31b3cd/proposals/-variadics-as-attribute.md