Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-24 Thread Chris Lattner via swift-evolution
> On Apr 22, 2016, at 4:05 PM, Vladimir.S wrote: > > After some discussions, I support this proposal and think this will make > Swift more consistent and clear about where is parameters and where is result > type. Especially this important in code like: > Int -> String -> Void -> Float > which

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-24 Thread Chris Lattner via swift-evolution
On Apr 23, 2016, at 6:01 AM, Haravikk via swift-evolution wrote: > While I know it might be a bit strange to have different rules for each side, > I think I prefer empty brackets on the left and Void on the right, but in > combination with required parenthesis on the left. FWIW, it *does* make

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-23 Thread Vladimir.S via swift-evolution
>.. To me, it feel like extra syntax where the -> is already making it very clear that we're dealing with a function... Can't agree with you. I don't think it's "very clear" where the function and where is result type here: Int -> String -> Void -> Float in compare to this: (Int) -> (Strin

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-23 Thread Chris Eidhof via swift-evolution
(Sorry to be hijacking a different subthread, but I only just subscribed again to the mailing list) I understand why the proposal has its benefits. Yet, if we look at the SE-0009 rationale, we could apply much of that as an argument against this proposal, e.g. "anything that is widely repeated bec

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-23 Thread Haravikk via swift-evolution
While I know it might be a bit strange to have different rules for each side, I think I prefer empty brackets on the left and Void on the right, but in combination with required parenthesis on the left. So we’d have: () -> Void // yes Void -> () // no

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-23 Thread Антон Жилин via swift-evolution
> > Therefore the impermissible: > (()) -> () Is identical to: > (Void) -> () So to follow these rules, it must instead be: > Void -> () … and we’re back to T1 -> T2 :* )* Wrong! If we enforce parentheses in function types, we won't be able to write Void -> () Parentheses will be required on th

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
Yes, I believe we all know that Void actually is () and yes, there probably some difficulties in implementation of the rules. The main question right now, as I see it, if we (most of us) agree with these rules in general. And then, we can think/ask if such rules could be implemented by core te

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
After some discussions, I support this proposal and think this will make Swift more consistent and clear about where is parameters and where is result type. Especially this important in code like: Int -> String -> Void -> Float which IMO should be (Int) -> (String) -> (Void) -> Float as Int/Stri

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Alan Skipp via swift-evolution
> On 22 Apr 2016, at 23:43, Vladimir.S via swift-evolution > wrote: > > 3. Disallow putting empty tuple () in parentheses The thing is, Void is a typealias for () Therefore the impermissible: (()) -> () Is identical to: (Void) -> () So to follow these rules, it must instead be: Void -> () …

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
On 23.04.2016 0:52, Антон Жилин wrote: We can disallow putting types in parentheses in single-element tuple meaning. For example, (Int) -> (Double) will be illegal because of (Double). (Int) -> (Double) -> Bool will be legal, because parentheses mean function type here. (Int) -> () will be legal,

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Антон Жилин via swift-evolution
We can disallow putting types in parentheses in single-element tuple meaning. For example, (Int) -> (Double) will be illegal because of (Double). (Int) -> (Double) -> Bool will be legal, because parentheses mean function type here. (Int) -> () will be legal, because () means Void here. This can be

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
On 22.04.2016 22:27, L. Mihalkovic wrote: Void seems unequivocal, while () seems to beg for a context to be fully understood Personally I don't insist to remove the Void, but actually I'd prefer to choose some only one variant how we can express an emtpy result. IMO there is something wrong

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread L. Mihalkovic via swift-evolution
Void seems unequivocal, while () seems to beg for a context to be fully understood Regards > On Apr 22, 2016, at 8:28 PM, Erica Sadun via swift-evolution > wrote: > > >> On Apr 22, 2016, at 12:08 PM, Vladimir.S via swift-evolution >> wrote: >> About the "Void".. I'm +1 on this idea, but as

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Erica Sadun via swift-evolution
> On Apr 22, 2016, at 12:08 PM, Vladimir.S via swift-evolution > wrote: > About the "Void".. I'm +1 on this idea, but asking myself if we can freely > remove 'Void' from our language at all without any problem? Can't find the > answer. It seems like we can, IMO using the syntax like () -> () i

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
On 22.04.2016 20:17, Антон Жилин wrote: Vladimir, I agree with Chris Lattner that function parameters are different from function return value in Swift. Firstly, syntax of function call allows for easy forwarding of values, which came from different places, as parameters to a single function: f(

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Антон Жилин via swift-evolution
Vladimir, I agree with Chris Lattner that function parameters are different from function return value in Swift. Firstly, syntax of function call allows for easy forwarding of values, which came from different places, as parameters to a single function: f(g(foo, 1), h(bar(buz))) On the other hand

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Vladimir.S via swift-evolution
IMO +1 for Антон's suggestion, but "It will also eliminate situation when you can pass () argument to a () → T function." What do you think about the result "type": typealias f1 = () -> Void typealias f2 = () -> ((Void)) typealias f3 = () -> (()) typealias f4 = () -> ((())) They are al

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-22 Thread Антон Жилин via swift-evolution
+1, but this proposal need further work. Specification of the new function grammar is needed. Currently, it looks like: function-type → type ­throws­opt­->

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-21 Thread BJ Homer via swift-evolution
How would this proposal affect curried functions? Would this: func foo(int: Int) -> Int -> String -> String become this? func foo(int: Int) -> (((Int) -> String) -> String) As I understand, that transformation is an accurate representation of the actual return type of “foo”, but it’s cer

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-21 Thread Jeremy Pereira via swift-evolution
> On 20 Apr 2016, at 15:40, Erica Sadun wrote: > > >> On Apr 20, 2016, at 5:09 AM, Jeremy Pereira >> wrote: >> >> >>> On 19 Apr 2016, at 17:24, Erica Sadun via swift-evolution >>> wrote: >>> >>> Short of a complete rethink of closure syntax, requiring parentheses there >>> would n

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-21 Thread Vladimir.S via swift-evolution
In this particular case I belive func foo(int: Int) -> (Int) -> (String) -> String is much more explicit and clear about what is what : foo(int: Int) returns not Int(that returns then String and then String). foo(int: Int) return function with (Int) parameter, that return func with (String) p

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Chris Lattner via swift-evolution
> On Apr 20, 2016, at 8:46 AM, BJ Homer wrote: > > How would this proposal affect curried functions? Would this: > > func foo(int: Int) -> Int -> String -> String > > become this? > > func foo(int: Int) -> (((Int) -> String) -> String) No, it becomes: func foo(int: Int) -> (Int) -> (Strin

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Erica Sadun via swift-evolution
On Apr 20, 2016, at 9:46 AM, BJ Homer via swift-evolution wrote: > > How would this proposal affect curried functions? Would this: > > func foo(int: Int) -> Int -> String -> String > > become this? > > func foo(int: Int) -> (((Int) -> String) -> String) > > As I understand, that transforma

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread BJ Homer via swift-evolution
How would this proposal affect curried functions? Would this: func foo(int: Int) -> Int -> String -> String become this? func foo(int: Int) -> (((Int) -> String) -> String) As I understand, that transformation is an accurate representation of the actual return type of “foo”, but it’s certa

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Alan Skipp via swift-evolution
A quick grep showed about 50 cases of using T1 -> T2 in my current project. Not a huge amount, but not tiny either. It wouldn’t be a completely dreadful change to make, just irritating having to add superfluous syntactical appendages to pacify the computer. > On 20 Apr 2016, at 00:28, Jacob Ban

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Dave DeLong via swift-evolution
A massive -1 to this proposal. Eliminating parenthesis increases readability and mental parse-ability. As my own datapoint, I have 276 instances of “[^) ] *->” across 93 source files in one of the apps I maintain. I love that I can do “T1 -> T2” as my function definitions, and the ability to le

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Erica Sadun via swift-evolution
> On Apr 20, 2016, at 5:09 AM, Jeremy Pereira > wrote: > > >> On 19 Apr 2016, at 17:24, Erica Sadun via swift-evolution >> wrote: >> >>> >> Short of a complete rethink of closure syntax, requiring parentheses there >> would not improve the language in any measurable way. > > Does requiri

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Jeremy Pereira via swift-evolution
> On 20 Apr 2016, at 08:02, Vladimir.S via swift-evolution > wrote: > > Great points! We definitely have some mess with tuples¶meters list in > current Swift. Especially after we removed tuple splat feature. > > But right now can't see what we can do about this. > > (T1,T2) -> (T3,T4) really

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Jeremy Pereira via swift-evolution
> On 19 Apr 2016, at 17:24, Erica Sadun via swift-evolution > wrote: > >> > Short of a complete rethink of closure syntax, requiring parentheses there > would not improve the language in any measurable way. Does requiring the parentheses in (T1) -> T2 improve the language in any measurable

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-20 Thread Vladimir.S via swift-evolution
Great points! We definitely have some mess with tuples¶meters list in current Swift. Especially after we removed tuple splat feature. But right now can't see what we can do about this. (T1,T2) -> (T3,T4) really reads as "tuple (T1,T2) to tuple (T3,T4)" and this is partially true as result is r

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Paul Ossenbruggen via swift-evolution
+1 can we get rid of void? > On Apr 19, 2016, at 7:11 AM, Patrick Smith via swift-evolution > wrote: > I think () reads nicer than Void, and has a sort of beauty that () literally > looks like nothing, unlike some word. ___ swift-evolution mailing l

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Jacob Bandes-Storch via swift-evolution
On Tue, Apr 19, 2016 at 3:29 PM, Dave Abrahams via swift-evolution < swift-evolution@swift.org> wrote: > > on Tue Apr 19 2016, Alan Skipp wrote: > > > I’d place the ability to omit parenthesises for single args in the same > category > > as being able to omit `self` when accessing properties. The

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Dave Abrahams via swift-evolution
on Tue Apr 19 2016, Alan Skipp wrote: > I’d place the ability to omit parenthesises for single args in the same > category > as being able to omit `self` when accessing properties. They are small > conveniences that make a large difference to an entire codebase. Care to back that up with some

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Thorsten Seitz via swift-evolution
Well said! -Thorsten > Am 19.04.2016 um 18:01 schrieb Alan Skipp via swift-evolution > : > > I’d place the ability to omit parenthesises for single args in the same > category as being able to omit `self` when accessing properties. They are > small conveniences that make a large difference t

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Apr 19, 2016, at 1:24 PM, David Owens II via swift-evolution > wrote: > > I have a different read of the proposal I guess... I actually find that this: > > (Int, Int) -> (Int, Int) > > Naturally reads take a single pair (e.g. tuple) of (Int, Int) and return a > singl

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Michael Peternell via swift-evolution
@Radek: I totally agree, and would like to add some more reasons. (For me), (parenthesis are mostly (a tool) to disambiguate the (parse tree)). a parenthesis around (just (one token)) doesn't really make sense, or disambiguate anything, IMHO. They tell the parser, "you think I meant 'a+(b^2)' b

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread David Owens II via swift-evolution
I have a different read of the proposal I guess... I actually find that this: (Int, Int) -> (Int, Int) Naturally reads take a single pair (e.g. tuple) of (Int, Int) and return a single pair of (Int, Int) This actually looks and feels like the right implementation to me: let tx: (Int, Int) -> (

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Erica Sadun via swift-evolution
> On Apr 19, 2016, at 9:44 AM, David Rönnqvist > wrote: > > Would this also affect the syntax for naming closure arguments? For example, > would this (taken from "The Swift Programming Language (Swift 2.2)”): > reversed = names.sort( { s1, s2 in return s1 > s2 } ) > have to be written like t

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread David Owens II via swift-evolution
> On Apr 19, 2016, at 7:49 AM, Erica Sadun via swift-evolution > wrote: > > >> On Apr 18, 2016, at 4:31 PM, Dave Abrahams via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> >> on Fri Apr 15 2016, Brent Royal-Gordon > > wrote: >> Gi

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Alan Skipp via swift-evolution
I’d place the ability to omit parenthesises for single args in the same category as being able to omit `self` when accessing properties. They are small conveniences that make a large difference to an entire codebase. > On 19 Apr 2016, at 15:49, Erica Sadun via swift-evolution > wrote: > > Apa

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread David Rönnqvist via swift-evolution
Would this also affect the syntax for naming closure arguments? For example, would this (taken from "The Swift Programming Language (Swift 2.2)”): reversed = names.sort( { s1, s2 in return s1 > s2 } ) have to be written like this: reversed = names.sort( { (s1, s2) in return s1 > s2 } ) or is t

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Sean Heber via swift-evolution
For what it’s worth, I searched my Swift code and didn’t find a single instance where I did *not* use the parens - even for single-argument functions. Until this conversation came up, I don’t recall if it ever even occurred to me that I *could* leave the parentheses out! l8r Sean > On Apr 19,

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Erica Sadun via swift-evolution
> On Apr 18, 2016, at 4:31 PM, Dave Abrahams via swift-evolution > mailto:swift-evolution@swift.org>> wrote: > > > on Fri Apr 15 2016, Brent Royal-Gordon > wrote: > >>> Given all this, I think it makes sense to go for syntactic >>> uniformity between paramete

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Alan Skipp via swift-evolution
Completely agree with Radek. I avoid unnecessary punctuation whenever possible, which increases legibility IMHO; so this pernickety proposal makes me sad : ( > On 19 Apr 2016, at 08:46, Radosław Pietruszewski via swift-evolution > wrote: > > Noo :( > > I understand and appreciate the rati

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Vladimir.S via swift-evolution
On 19.04.2016 17:11, Patrick Smith via swift-evolution wrote: I think () reads nicer than Void, and has a sort of beauty that () literally looks like nothing, unlike some word. The fact that you can nest it is trippy in a kind of cool way. In this case, why do we need Void at all in function

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Patrick Smith via swift-evolution
I think () reads nicer than Void, and has a sort of beauty that () literally looks like nothing, unlike some word. The fact that you can nest it is trippy  in a kind of cool way. Patrick Smith On Apr 19 2016, at 11:28 pm, Vladimir.S via swift-evolution wrote: Although I personally

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Vladimir.S via swift-evolution
Although I personally have no strong opinion on this proposal yet, it is clear for me that something is wrong with function type sintax&Void&(). Right now we have such situation, when all the next code is OK, can be compiled and run, but each fX has the same meaning: typealias f1 = () -> () ty

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread T.J. Usiyan via swift-evolution
-1 The parenthesis don't add anything, in my opinion. I could live with the change, I simply don't see much benefit. On Tue, Apr 19, 2016 at 8:45 AM, Matthew Johnson via swift-evolution < swift-evolution@swift.org> wrote: > > > Sent from my iPad > > > On Apr 19, 2016, at 2:46 AM, Radosław Pietru

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Apr 19, 2016, at 2:46 AM, Radosław Pietruszewski via swift-evolution > wrote: > > Noo :( > > I understand and appreciate the rationale, uniformity between declaration and > use site being a good thing, but IMHO the proposal just brings unnecessary > noise, far ou

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Thorsten Seitz via swift-evolution
+1 to everything Radek said -Thorsten > Am 19.04.2016 um 09:46 schrieb Radosław Pietruszewski via swift-evolution > : > > Noo :( > > I understand and appreciate the rationale, uniformity between declaration and > use site being a good thing, but IMHO the proposal just brings unnecessary

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-19 Thread Radosław Pietruszewski via swift-evolution
Noo :( I understand and appreciate the rationale, uniformity between declaration and use site being a good thing, but IMHO the proposal just brings unnecessary noise, far outweighing the small benefit of having the symmetry. 1. What I’m worried the most is the “parentheses blindness”. In hi

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-18 Thread Dave Abrahams via swift-evolution
on Fri Apr 15 2016, Brent Royal-Gordon wrote: >> Given all this, I think it makes sense to go for syntactic >> uniformity between parameter list and function types, and just >> require parenthesis on the argument list. The types above can be >> trivially written as: >> >> (Int) -> Float >> (

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-18 Thread Dave Abrahams via swift-evolution
on Thu Apr 14 2016, Chris Lattner wrote: > On Apr 14, 2016, at 10:21 PM, John McCall wrote: >> >>> On Apr 14, 2016, at 9:57 PM, Chris Lattner via swift-evolution >>> wrote: >>> >>> We currently accept function type syntax without parentheses, like: > >> To me, the unparenthesized style sugg

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-18 Thread Dave Abrahams via swift-evolution
on Thu Apr 14 2016, Chris Lattner wrote: > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wanted to > treat all functions as taking a single parameter (which was often of > tup

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-18 Thread Thorsten Seitz via swift-evolution
+1 I am against introducing more parentheses because the resulting code is much more unreadable IMO (those additional parentheses will typically appear in argument lists, which means that the additional parentheses will be nested in the parentheses of the argument list). As someone else said, t

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-16 Thread Chris Lattner via swift-evolution
> On Apr 16, 2016, at 8:48 PM, Chris Lattner via swift-evolution > wrote: > > >> On Apr 16, 2016, at 10:10 AM, Patrick Gili >> wrote: >> >> As an alternative, could we require the parens on the return. For example: >> >> (Int) -> (Float) >> (String) -> () >> () -> () >> () -> (Double) >>

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-16 Thread Chris Lattner via swift-evolution
On Apr 15, 2016, at 5:04 PM, David Owens II wrote: > It’s weird to me that we can essentially erase the parameter names and > fallback to just the type signatures, but that can be a talk for another day. I agree that that is odd. In my opinion, it should be accepted to convert from a function

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-16 Thread Chris Lattner via swift-evolution
> On Apr 16, 2016, at 10:10 AM, Patrick Gili > wrote: > > As an alternative, could we require the parens on the return. For example: > > (Int) -> (Float) > (String) -> () > () -> () > () -> (Double) > > This looks cleaner, improves consistency, and simplifies the syntax (i.e., no > need to r

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-16 Thread Dave via swift-evolution
> On Apr 16, 2016, at 12:10 PM, Patrick Gili via swift-evolution > wrote: > > As an alternative, could we require the parens on the return. For example: > > (Int) -> (Float) > (String) -> () > () -> () > () -> (Double) > > This looks cleaner, improves consistency, and simplifies the syntax (i

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-16 Thread Patrick Gili via swift-evolution
As an alternative, could we require the parens on the return. For example: (Int) -> (Float) (String) -> () () -> () () -> (Double) This looks cleaner, improves consistency, and simplifies the syntax (i.e., no need to remember when parens are necessary). -Patrick > On Apr 15, 2016, at 1:38 PM,

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Howard Lovatt via swift-evolution
Doesn't really seem worth the trouble to me. It is fine as it is. Other languages like Java and Scala allow this short hand and Swift allows it in closures. Not that I am that fussed since the brackets are no big deal. On Saturday, 16 April 2016, John McCall via swift-evolution < swift-evolution@s

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread John McCall via swift-evolution
> On Apr 15, 2016, at 2:47 PM, Joe Groff wrote: >> On Apr 15, 2016, at 11:43 AM, John McCall wrote: >>> On Apr 15, 2016, at 10:41 AM, Joe Groff wrote: On Apr 15, 2016, at 8:29 AM, John McCall via swift-evolution wrote: > On Apr 14, 2016, at 10:50 PM, Chris Lattner wrote: >

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread David Owens II via swift-evolution
> On Apr 15, 2016, at 1:07 PM, Chris Lattner wrote: > > >> On Apr 15, 2016, at 11:27 AM, David Owens II > > wrote: >> >> Hmm... I don't think this is clearer: >> >> let fn: (Int) -> (Int) -> Int >> >> I think it's much less readable and really, the () are syntacti

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Brent Royal-Gordon via swift-evolution
> So, `Void->Int` functions would work like this? > let foo = bar(()) // returns Int Yes. -- Brent Royal-Gordon Architechies ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Joe Groff via swift-evolution
> On Apr 15, 2016, at 11:43 AM, John McCall wrote: > >> On Apr 15, 2016, at 10:41 AM, Joe Groff wrote: >>> On Apr 15, 2016, at 8:29 AM, John McCall via swift-evolution >>> wrote: >>> On Apr 14, 2016, at 10:50 PM, Chris Lattner wrote: On Apr 14, 2016, at 10:40 PM, John McCall wrot

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Dave via swift-evolution
So, `Void->Int` functions would work like this? let foo = bar(()) // returns Int > On Apr 15, 2016, at 3:23 PM, Brent Royal-Gordon via swift-evolution > wrote: > > What I think we *should* eliminate, however, is using `Void` to mean "no > arguments" in a closure type. `Void -> Int` should mean

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Brent Royal-Gordon via swift-evolution
> Given all this, I think it makes sense to go for syntactic uniformity between > parameter list and function types, and just require parenthesis on the > argument list. The types above can be trivially written as: > > (Int) -> Float > (String) -> () > > Thoughts? While it's technically cor

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Chris Lattner via swift-evolution
> On Apr 15, 2016, at 11:27 AM, David Owens II wrote: > > Hmm... I don't think this is clearer: > > let fn: (Int) -> (Int) -> Int > > I think it's much less readable and really, the () are syntactically > redundant: the -> is really what distinguishes this as a function. > > Also, this w

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Michael Peternell via swift-evolution
I don't see any advantage of requiring parenthesis. I think programmers should be allowed to write (Int) -> Int, and they should also be allowed to write Int -> Int. -Michael ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swi

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread John McCall via swift-evolution
> On Apr 15, 2016, at 10:41 AM, Joe Groff wrote: >> On Apr 15, 2016, at 8:29 AM, John McCall via swift-evolution >> wrote: >> >>> On Apr 14, 2016, at 10:50 PM, Chris Lattner wrote: >>> On Apr 14, 2016, at 10:40 PM, John McCall wrote: >> To me, the unparenthesized style suggests that the i

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread David Owens II via swift-evolution
Hmm... I don't think this is clearer: let fn: (Int) -> (Int) -> Int I think it's much less readable and really, the () are syntactically redundant: the -> is really what distinguishes this as a function. Also, this would look like a error now: let fn: (Int) -> () Did the user mean tha

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Joe Groff via swift-evolution
> On Apr 15, 2016, at 8:29 AM, John McCall via swift-evolution > wrote: > >> On Apr 14, 2016, at 10:50 PM, Chris Lattner wrote: >> On Apr 14, 2016, at 10:40 PM, John McCall wrote: > To me, the unparenthesized style suggests that the input and output are > peers, which feels more natu

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Chris Lattner via swift-evolution
On Apr 15, 2016, at 12:47 AM, Andrey Tarantsov wrote: > Chris, > >> Given all this, I think it makes sense to go for syntactic uniformity >> between parameter list and function types, and just require parenthesis on >> the argument list. The types above can be trivially written as: >> >> (In

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Chris Lattner via swift-evolution
> On Apr 15, 2016, at 5:11 AM, David Hart wrote: > > If the original rationale is gone, shouldn’t we also get rid of the empty > tuple-type and replace it by a full-blown Void instead of Void being a > typealis for the empty tuple? This could be done, but it would make the language larger and

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Ilya Belenkiy via swift-evolution
I understand the reasoning, but I really like and often use the shorthand notation. I hope that it stays. On Fri, Apr 15, 2016 at 12:58 AM Chris Lattner via swift-evolution < swift-evolution@swift.org> wrote: > We currently accept function type syntax without parentheses, like: > > Int -> Float

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread John McCall via swift-evolution
> On Apr 14, 2016, at 10:50 PM, Chris Lattner wrote: > On Apr 14, 2016, at 10:40 PM, John McCall wrote: To me, the unparenthesized style suggests that the input and output are peers, which feels more natural for the sort of value-to-value transform/predicate where this most commo

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Haravikk via swift-evolution
+1 to the proposal > On 15 Apr 2016, at 13:11, David Hart via swift-evolution > wrote: > > If the original rationale is gone, shouldn’t we also get rid of the empty > tuple-type and replace it by a full-blown Void instead of Void being a > typealis for the empty tuple? > > (Int) -> Float > (

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread David Hart via swift-evolution
If the original rationale is gone, shouldn’t we also get rid of the empty tuple-type and replace it by a full-blown Void instead of Void being a typealis for the empty tuple? (Int) -> Float (String) -> Void () -> Void () -> Double It looks more consistent to me. > On 15 Apr 2016, at 06:57,

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Taras Zakharko via swift-evolution
+1 Makes language cleaner and more consistent. > On 15 Apr 2016, at 06:57, Chris Lattner via swift-evolution > wrote: > > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wante

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Andrey Tarantsov via swift-evolution
Chris, > Given all this, I think it makes sense to go for syntactic uniformity between > parameter list and function types, and just require parenthesis on the > argument list. The types above can be trivially written as: > > (Int) -> Float > (String) -> () I don't care about this particula

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-15 Thread Developer via swift-evolution
+1. The only times I've ever had to use this outside of HoFs were dirty, dirty hacks that probably should have used this anyway. I can stomach an extra bit of syntax everywhere if it means removing an inconsistency in the wider language. ~Robert Widmann 2016/04/15 0:57、Chris Lattner via swif

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Chris Lattner via swift-evolution
> On Apr 14, 2016, at 10:50 PM, Chris Lattner via swift-evolution > wrote: > > On Apr 14, 2016, at 10:40 PM, John McCall wrote: To me, the unparenthesized style suggests that the input and output are peers, which feels more natural for the sort of value-to-value transform/pred

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Dave via swift-evolution
> On Apr 15, 2016, at 12:40 AM, John McCall via swift-evolution > wrote: > >> On Apr 14, 2016, at 10:28 PM, Chris Lattner wrote: >> >> In many places in the Swift grammar we aim for consistency, even if it means >> a bit more punctuation in specific cases. > > This is not greatly in evidenc

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Chris Lattner via swift-evolution
On Apr 14, 2016, at 10:40 PM, John McCall wrote: >>> To me, the unparenthesized style suggests that the input and output are >>> peers, which feels more natural for the sort of value-to-value >>> transform/predicate where this most commonly occurs. Parenthesizing the >>> input feels fussier, w

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread John McCall via swift-evolution
> On Apr 14, 2016, at 10:28 PM, Chris Lattner wrote: > > On Apr 14, 2016, at 10:21 PM, John McCall wrote: >> >>> On Apr 14, 2016, at 9:57 PM, Chris Lattner via swift-evolution >>> wrote: >>> >>> We currently accept function type syntax without parentheses, like: > >> To me, the unparenthesi

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Chris Lattner via swift-evolution
On Apr 14, 2016, at 10:21 PM, John McCall wrote: > >> On Apr 14, 2016, at 9:57 PM, Chris Lattner via swift-evolution >> wrote: >> >> We currently accept function type syntax without parentheses, like: > To me, the unparenthesized style suggests that the input and output are > peers, which fe

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread John McCall via swift-evolution
> On Apr 14, 2016, at 9:57 PM, Chris Lattner via swift-evolution > wrote: > > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wanted to treat > all functions as taking a single

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread hitstergtd+swiftevo--- via swift-evolution
Chris, The proposed syntax looks and reads so much better! +1. On 15 April 2016 at 05:57, Chris Lattner via swift-evolution wrote: > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Dave via swift-evolution
+1 > On Apr 14, 2016, at 11:57 PM, Chris Lattner via swift-evolution > wrote: > > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wanted to treat > all functions as taking a s

Re: [swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Erica Sadun via swift-evolution
> On Apr 14, 2016, at 10:57 PM, Chris Lattner via swift-evolution > wrote: > > We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wanted to treat > all functions as taking a sing

[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

2016-04-14 Thread Chris Lattner via swift-evolution
We currently accept function type syntax without parentheses, like: Int -> Float String -> () etc. The original rationale aligned with the fact that we wanted to treat all functions as taking a single parameter (which was often of tuple type) and producing a tuple value (which was sometime