Closed CasperVector closed 6 years ago
Thanks for the input. Do you have a short yet compelling example? :smile:
Offhand, it looks to me like
while (condition) {
... stuff ...
if (something)
continue;
.... more stuff ..
}
can always be replaced by
while (condition) {
... stuff ...
if (!something) {
... more stuff ...
}
}
loop {
stuff1 ...
cond1 || continue
stuff2 ...
cond2 || continue
...
}
(Similar constructs also occur with return
and break
:)
Two reasons I'd vote to add continue
:
break
and continue
can be replaced by ifs()
; but continue
can help reduce excessive indentation.I have an implementation of continue
in my repository. If there is a consensus for adding it, I'd be glad to post it for a pull.
@borkovic I'd be very interested to see your implementaton. Can you turn it into a pull request?
I am out of town. I'll try to do it over the weekend.
On Fri, Aug 25, 2017 at 12:44 PM Toby Goodwin notifications@github.com wrote:
@borkovic https://github.com/borkovic I'd be very interested to see your implementaton. Can you turn it into a pull request?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rakitzis/rc/issues/25#issuecomment-325018346, or mute the thread https://github.com/notifications/unsubscribe-auth/AMYWdVyldshL9bh6PtLh1FLX2p38vr4Oks5sbyQ4gaJpZM4JrtJE .
Thanks, looks great! (I particularly like the new assert()
in unexcept()
)
I've pushed a branch called continue
to the main github repo, in case other people want to play with it. I'll merge this into master
in the next few days unless anyone objects.
Glad to contribute.
Interesting that you like assert() in unexcept(): I was not sure whether to make 'continue' change alone or to include assert()+unexcept() as well.
On Mon, Aug 28, 2017 at 12:51 PM, Toby Goodwin notifications@github.com wrote:
Thanks, looks great! (I particularly like the new assert() in unexcept()) I've pushed a branch called continue to the main github repo, in case other people want to play with it. I'll merge this into master in the next few days unless anyone objects.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rakitzis/rc/issues/25#issuecomment-325460424, or mute the thread https://github.com/notifications/unsubscribe-auth/AMYWdaSKvAGXyCwHFQUav-OjQ_-hGAE-ks5scxpNgaJpZM4JrtJE .
merged
return
andbreak
have been reintroduced into this neatrc
implementation. May I request to also addcontinue
? This can be really helpful for some constructs.