I think I understand Yarden. I did some C# recently, which does not have *implicit* switch case fall-through and forces you to end all switch case bodies with break (for clarity I guess). It felt redundant coming from Swift. I understand why Adrian would feel the same way about void-return statements in guard. I don’t know, I’m a bit undecided on this issue. If we imagine this proposal, the fact that it only works on void-returning functions feels a bit weird.
> On 20 Jun 2016, at 18:08, Xiaodi Wu via swift-evolution > <[email protected]> wrote: > > On the contrary, having a compiler error for a guard body that doesn't exit > the scope is the very point of having guard. > > The links were for your review because the discussion on this idea has been > extensive and both times reached consensus that this is not a workable idea. > > > On Mon, Jun 20, 2016 at 09:12 Yarden Eitan via swift-evolution > <[email protected] <mailto:[email protected]>> wrote: > Adrian: I would prefer to not have it at all. But this is a better > alternative than a brand new line declaring a return, and nothing else. This > is inline and part of the ‘guard’ declaration (better context), and > definitely better than having a warning stay in your codebase. > > Putting the code clarity aside, having a compiler error for a non-returned > guard seems like an overkill, and different that the other Swift > implementations (such as Switch that doesn’t need a break to not fall > through). > > Xiaodi: Thank you for the links. Was an actual proposal ever formed for this, > or was it decided not to move forward? > > Yarden > > > > On June 20, 2016 at 1:33:54 AM, Adrian Zubarev via swift-evolution > ([email protected] <mailto:[email protected]>) wrote: > >> @implicitreturn guard a = b else { print(“foo”) } >> >> Isn’t that just the same? I mean now you even write more boilerplate then >> bebore. >> >> How does your return type look, what are you trying to solve? >> >> >> >> -- >> Adrian Zubarev >> Sent with Airmail >> >> Am 20. Juni 2016 um 08:30:39, Yarden Eitan via swift-evolution >> ([email protected] <mailto:[email protected]>) schrieb: >> >>> @implicitreturn guard a = b else { print(“foo”) } >> >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> > _______________________________________________ > swift-evolution mailing list > [email protected] <mailto:[email protected]> > https://lists.swift.org/mailman/listinfo/swift-evolution > <https://lists.swift.org/mailman/listinfo/swift-evolution> > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
