Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-04 Thread Howard Lovatt via swift-evolution
-1. Doesn’t seem worthwhile. There aren’t that many use cases were your code gets littered with try and it is nice to identify exactly what is throwing. Sorry, — Howard. > On 4 Jan 2016, at 2:52 PM, Andrew Duncan via swift-evolution > wrote: > > >> On 3 Jan, 2016, at 10:51, David Waite wr

[swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-04 Thread Andrew Duncan via swift-evolution
>> >> func recognizeHandler() throws { >>try { >>accept(.on)// .on is an enum tag for the token for the ‘on’ >> keyword. >>recognizeName() >>recognizeFormalParamSeq() >>accept(.newline) >>recognizeCommandSeq() >>accept(.end) >>

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Tyler Fleming Cloutier via swift-evolution
> On Jan 3, 2016, at 7:38 PM, Matthew Johnson > wrote: > >> >> On Jan 3, 2016, at 9:31 PM, Tyler Fleming Cloutier via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> Please see inline comments. >> >> >>> On Jan 3, 2016, at 6:48 PM, Tyler Fle

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Andrew Duncan via swift-evolution
> On 3 Jan, 2016, at 10:51, David Waite wrote: > > One possible approach if it was desirable to not have this used arbitrarily > in place of do+try, and to avoid looking too much like exception syntax: > instead define rethrows blocks: > > func recognizeHandler() throws { > rethrows {

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Chris Lattner via swift-evolution
> On Jan 3, 2016, at 6:36 PM, Matthew Johnson via swift-evolution > wrote: >>> >>> I agree that requiring this is not likely to result in improved error >>> handling and thus is not a strong argument in favor of it. >>> >>> IMO the purpose of requiring “try” to be stated explicitly is that it

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Matthew Johnson via swift-evolution
> On Jan 3, 2016, at 9:31 PM, Tyler Fleming Cloutier via swift-evolution > wrote: > > Please see inline comments. > > >> On Jan 3, 2016, at 6:48 PM, Tyler Fleming Cloutier via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> Indeed both are reasonable but perhaps suboptima

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Tyler Fleming Cloutier via swift-evolution
Please see inline comments. > On Jan 3, 2016, at 6:48 PM, Tyler Fleming Cloutier via swift-evolution > wrote: > > Indeed both are reasonable but perhaps suboptimal. Consider the following > potential changes. > > > // Assume this code is included for the below examples. > func myThrowingFun

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Tyler Fleming Cloutier via swift-evolution
Indeed both are reasonable but perhaps suboptimal. Consider the following potential changes. // Assume this code is included for the below examples. func myThrowingFunc() throws -> String { if drand48() < 0.5 { throw NSError(domain: "", code: 0, userInfo: nil) } return "" } l

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Matthew Johnson via swift-evolution
> On Jan 3, 2016, at 1:37 PM, Dave Abrahams wrote: > >> >> On Jan 3, 2016, at 10:21 AM, Matthew Johnson wrote: >> >>> >>> On Jan 3, 2016, at 12:12 PM, Dave Abrahams via swift-evolution >>> wrote: >>> >>> On Jan 2, 2016, at 2:23 PM, Tyler Cloutier wrote: Please see commen

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Dave Abrahams via swift-evolution
> On Jan 3, 2016, at 10:51 AM, David Waite wrote: > > In a block of code where errors are only thrown in some places, do+try is > illustrative because it allows you to know which functions are possible > failure points. > > However, in a block of code where errors are thrown in most places, a

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Dave Abrahams via swift-evolution
> On Jan 3, 2016, at 10:21 AM, Matthew Johnson wrote: > >> >> On Jan 3, 2016, at 12:12 PM, Dave Abrahams via swift-evolution >> wrote: >> >> >>> On Jan 2, 2016, at 2:23 PM, Tyler Cloutier wrote: >>> >>> Please see comments inline. >>> On Dec 31, 2015, at 12:07 PM, Dave Abrahams via

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Goffredo Marocchi via swift-evolution
> On 3 Jan 2016, at 18:21, Matthew Johnson via swift-evolution > wrote: > > >> On Jan 3, 2016, at 12:12 PM, Dave Abrahams via swift-evolution >> wrote: >> >> >>> On Jan 2, 2016, at 2:23 PM, Tyler Cloutier wrote: >>> >>> Please see comments inline. >>> On Dec 31, 2015, at 12:07 PM,

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread David Waite via swift-evolution
In a block of code where errors are only thrown in some places, do+try is illustrative because it allows you to know which functions are possible failure points. However, in a block of code where errors are thrown in most places, a try block would be useful because individual try statements bec

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Matthew Johnson via swift-evolution
> On Jan 3, 2016, at 12:12 PM, Dave Abrahams via swift-evolution > wrote: > > >> On Jan 2, 2016, at 2:23 PM, Tyler Cloutier wrote: >> >> Please see comments inline. >> >>> On Dec 31, 2015, at 12:07 PM, Dave Abrahams via swift-evolution >>> wrote: >>> >>> > On Dec 27, 2015, at 10:25

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Dave Abrahams via swift-evolution
> On Jan 2, 2016, at 2:23 PM, Tyler Cloutier wrote: > > Please see comments inline. > >> On Dec 31, 2015, at 12:07 PM, Dave Abrahams via swift-evolution >> wrote: >> >> On Dec 27, 2015, at 10:25 PM, Brent Royal-Gordon via swift-evolution wrote: So “try” instead of “do

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Dave Abrahams via swift-evolution
> On Jan 3, 2016, at 2:08 AM, Andrew Duncan via swift-evolution > wrote: > > >> >>> There are large classes of programs where you can know you don’t care >>> exactly where a failure happens, e.g. (most init functions, all pure >>> functions, any function that doesn’t break invariants). In

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-03 Thread Andrew Duncan via swift-evolution
> >> There are large classes of programs where you can know you don’t care >> exactly where a failure happens, e.g. (most init functions, all pure >> functions, any function that doesn’t break invariants). In these cases >> marking every statement or expression that can throw is just noise.

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2016-01-02 Thread Tyler Cloutier via swift-evolution
Please see comments inline. > On Dec 31, 2015, at 12:07 PM, Dave Abrahams via swift-evolution > wrote: > > >>> On Dec 27, 2015, at 10:25 PM, Brent Royal-Gordon via swift-evolution >>> wrote: >>> >>> So “try” instead of “do”. If there is no catch, then just use braces >>> without a keyword

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-31 Thread Brent Royal-Gordon via swift-evolution
> There are large classes of programs where you can know you don’t care exactly > where a failure happens, e.g. (most init functions, all pure functions, any > function that doesn’t break invariants). In these cases marking every > statement or expression that can throw is just noise. Try writ

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-31 Thread Dave Abrahams via swift-evolution
> On Dec 27, 2015, at 10:25 PM, Brent Royal-Gordon via swift-evolution > wrote: > >> So “try” instead of “do”. If there is no catch, then just use braces without >> a keyword for a block. >> >> And use do-while instead of repeat-while. +1 > > Do you also propose no longer marking calls to

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-29 Thread Goffredo Marocchi via swift-evolution
I think we want to leave throws and rethrows at the method signature level and to mean that we want to throw an actual exception so I would not reuse it this way as it would be confusing. Sent from my iPhone > On 29 Dec 2015, at 14:24, Amir Michail wrote: > > >> On Dec 28, 2015, at 6:12 PM,

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-29 Thread Amir Michail via swift-evolution
> On Dec 28, 2015, at 6:12 PM, Goffredo Marocchi wrote: > > One could say that is extremely petty to redefine very commonly accepted > words (private when we mean file restricted, internal when we mean > essentially package when there are already pretty well understood meaning > from language

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-28 Thread Goffredo Marocchi via swift-evolution
One could say that is extremely petty to redefine very commonly accepted words (private when we mean file restricted, internal when we mean essentially package when there are already pretty well understood meaning from languages which quite frankly Swift will not kill now or 5 years from now...

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-28 Thread Amir Michail via swift-evolution
> On Dec 28, 2015, at 1:25 AM, Brent Royal-Gordon > wrote: > >> So “try” instead of “do”. If there is no catch, then just use braces without >> a keyword for a block. >> >> And use do-while instead of repeat-while. > > Do you also propose no longer marking calls to throwing functions with `

Re: [swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-27 Thread Brent Royal-Gordon via swift-evolution
> So “try” instead of “do”. If there is no catch, then just use braces without > a keyword for a block. > > And use do-while instead of repeat-while. Do you also propose no longer marking calls to throwing functions with `try`? Have you read the "Error-Handling Rationale" document in the Swift

[swift-evolution] use standard syntax instead of "do" and "repeat"

2015-12-27 Thread Amir Michail via swift-evolution
So “try” instead of “do”. If there is no catch, then just use braces without a keyword for a block. And use do-while instead of repeat-while. ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evo