Re: [swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-15 Thread Karl via swift-evolution
Done. https://bugs.swift.org/browse/SR-2963. > On 14 Oct 2016, at 22:42, John McCall wrote: > >> On Oct 11, 2016, at 12:04 AM, Karl via swift-evolution >> > wrote: >>> >>> On 11 Oct 2016, at 08:49, Benjamin

Re: [swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-14 Thread John McCall via swift-evolution
> On Oct 11, 2016, at 12:04 AM, Karl via swift-evolution > wrote: >> >> On 11 Oct 2016, at 08:49, Benjamin Spratling > > wrote: >> >> Howdy, >> The error message is not saying that aFunction throws, it says “??" might

Re: [swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-11 Thread Karl via swift-evolution
> On 11 Oct 2016, at 08:49, Benjamin Spratling wrote: > > Howdy, > The error message is not saying that aFunction throws, it says “??" might > throw. After all, you supplied a ()rethrows->(Int) to it as its second > argument, which is wrapping a ()throws->Int,

Re: [swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-11 Thread Benjamin Spratling via swift-evolution
Howdy, The error message is not saying that aFunction throws, it says “??" might throw. After all, you supplied a ()rethrows->(Int) to it as its second argument, which is wrapping a ()throws->Int, “bFunction()" ?? and && and || wrap the trailing expression in an @autoclosure. I am a little

Re: [swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-11 Thread Ben Rimmington via swift-evolution
> On 11 Oct 2016, at 07:16, Karl wrote: > > You might expect this code to work: > > func aFunction() -> Int? { return 5 } > func bFunction() throws -> Int { return 4 } > > let value = aFunction() ?? try bFunction() // ERROR: Operator can throw but > expression is not marked with a ‘try'

[swift-evolution] [Pitch] Change location of 'try' for infix operators

2016-10-11 Thread Karl via swift-evolution
You might expect this code to work: func aFunction() -> Int? { return 5 } func bFunction() throws -> Int { return 4 } let value = aFunction() ?? try bFunction() // ERROR: Operator can throw but expression is not marked with a ‘try' print(value) Instead, you must put the ‘try’ before the