Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-12 Thread David Sweeris via swift-evolution
> On Jun 12, 2017, at 5:13 PM, Pavol Vaskovic via swift-evolution > wrote: > > On Sun, Jun 11, 2017 at 1:52 AM, Haravikk via swift-evolution > > wrote: > > With the ability to specify throwaway variables

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-12 Thread Pavol Vaskovic via swift-evolution
On Sun, Jun 11, 2017 at 1:52 AM, Haravikk via swift-evolution < swift-evolution@swift.org> wrote: > > With the ability to specify throwaway variables more easily, I'm sticking > with my using syntax here: > > var theNames:[String] = [] > while let eachItem = theIterator.next() using (var theTotal

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Haravikk via swift-evolution
> On 10 Jun 2017, at 13:33, Xiaodi Wu via swift-evolution > wrote: > > _Every_ addition to the basic syntax of the language is, by definition, high > cost. The bar for additions to the standard library is already very high; the > bar for additions to control flow

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Gor Gyolchanyan via swift-evolution
Judging by the fact that the error says something like "missing `while`" and "use `repeat`instead", it looks like a bug in the parser, where it goes with the `do-while` to `repeat-while` transition error before checking for other possible constructs like `do { }`. > On Jun 10, 2017, at 4:30

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Xiaodi Wu via swift-evolution
Well, IMO, if that change was intentional, it’s the original change that warrants a full-fledged proposal. Without it, I think it’d be justified to call this a regression and file a bug! On Sat, Jun 10, 2017 at 09:29 Gor Gyolchanyan wrote: > Yeah. So, what's the official

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Gor Gyolchanyan via swift-evolution
Yeah. So, what's the official process for these kinds of things? I imagine it would warrant a full-fledged proposal, would it? > On Jun 10, 2017, at 4:26 PM, Xiaodi Wu wrote: > > I did not realize that change occurred with `do {}`! That seems like it > should be a

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Xiaodi Wu via swift-evolution
I did not realize that change occurred with `do {}`! That seems like it should be a regression, given that previously there was explicitly a fix-it to rewrite naked `{}` to `do {}`. On Sat, Jun 10, 2017 at 09:06 Gor Gyolchanyan wrote: > Yeah, that's why I mentioned a big

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Gor Gyolchanyan via swift-evolution
Yeah, that's why I mentioned a big **if** at the end. I love the `do { }` construct or variable isolation purposes and logical grouping, but unfortunately, Swift 4 has made it a lot uglier, by making it an error in its current form: do { let a = "123" print(a) } // error:

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Xiaodi Wu via swift-evolution
_Every_ addition to the basic syntax of the language is, by definition, high cost. The bar for additions to the standard library is already very high; the bar for additions to control flow syntax would be extraordinarily high. The proposed use case here is far from the original topic of repeat {}

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Goffredo Marocchi via swift-evolution
If it is low cost and people do not come up with regressions/high cost + negative impact scenarios then I would say go full steam ahead. It does address an annoying scenario. Sent from my iPhone > On 10 Jun 2017, at 12:04, Gor Gyolchanyan wrote: > > Not much, I think.

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Gor Gyolchanyan via swift-evolution
Not much, I think. The `where` clause already exists, conditional `let` and `var` binding already exists. It'd take loosening up conditional binding rules a bit and expanding the lexical structure to include `let` and `var` bindings in `repeat`. > On Jun 10, 2017, at 2:01 PM, Goffredo Marocchi

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Goffredo Marocchi via swift-evolution
Quite interesting :), what impact would it have on the compiler? Sent from my iPhone > On 10 Jun 2017, at 11:46, Gor Gyolchanyan via swift-evolution > wrote: > > I think a better way of achieving this would be to use the already existing > `where` keyword in loops.

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Gor Gyolchanyan via swift-evolution
I think a better way of achieving this would be to use the already existing `where` keyword in loops. The way it works right now is as follows: let many = [1, 2, 3, 4, 5] for each in many where each % 2 == 0 { print("found an even number: \(each)") } Unfortunately, unlike all other

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-10 Thread Haravikk via swift-evolution
Not sure if my e-mail didn't go through or if discussion just fizzled out; one other benefit if we ever move to a proper message board is we might gain the ability to bump topics. Anyway, I'll resend my message just in case: Just to add my thoughts, as I like the idea of adding the variables

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-06 Thread Xiaodi Wu via swift-evolution
On Tue, Jun 6, 2017 at 12:17 PM, Dave Abrahams via swift-evolution < swift-evolution@swift.org> wrote: > > > On Tue, Jun 6, 2017 at 4:05 AM, Michael Savich via swift-evolution < > > swift-evolution@swift.org> wrote: > > > >> It recently occurred to me how nice it would be to be if we could avoid

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-06 Thread Dave Abrahams via swift-evolution
> On Tue, Jun 6, 2017 at 4:05 AM, Michael Savich via swift-evolution < > swift-evolution@swift.org> wrote: > >> It recently occurred to me how nice it would be to be if we could avoid >> declaring variables outside of loops that are only used inside them. I used >> google’s site specific search

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-06 Thread Michael Savich via swift-evolution
Oh, I admit I had never realized do could be used outside of an error handling context. Yeah, then I would agree then this change is probably unnecessary. Looking at the Swift guidebook it may be a good idea make it more explicit that the do statement is meant to be used for things other than

Re: [swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"

2017-06-06 Thread Xiaodi Wu via swift-evolution
If I recall correctly, it was discussed during a time when additive proposals were not in scope, so it could not be proposed. Since at the moment we are currently between Swift 4 and Swift 5 evolution, the topic is not in scope either. With respect to the idea itself, Taras's post--which appears