Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'cont' to 'next' #2229

Closed
brson opened this issue Apr 17, 2012 · 21 comments
Closed

Rename 'cont' to 'next' #2229

brson opened this issue Apr 17, 2012 · 21 comments
Labels
A-grammar Area: The grammar of Rust E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Apr 17, 2012

'cont' sounds offensive, especially when spoken aloud. There's precedent for 'next' in other languages.

Remember to change the docs.

@catamorphism
Copy link
Contributor

Bikeshed: how about "skip"? It seems like variables are more likely to be named "next" than "skip".

@jamorton
Copy link
Contributor

Is there anything wrong with continue?

@brson
Copy link
Contributor Author

brson commented Apr 17, 2012

@Jonanin continue is 8 characters! In Rust we have a 5 character keyword limit.

But seriously, that's the reason.

@jamorton
Copy link
Contributor

... alright ...

interesting, I guess :]

@boggle
Copy link
Contributor

boggle commented Apr 17, 2012

A good rule is justified by it's exceptions. 'Next' is a very common variable name in linked lists and other data structures, I find 'skip' to be frequently used for boolean flags, while 'continue' is rarely used. That may be quite subjective but I'd rather have rust adopt 'continue'. As a compromise, I'd vote for 'resume' (which is a keyword in BASIC).

@pcwalton
Copy link
Contributor

I like skip.

@bstrie
Copy link
Contributor

bstrie commented Apr 18, 2012

Repasting from my mis-comment in 2233:

Also keep in mind how the keyword will sound with the labeled break/continue from #2216. For a loop labeled foo, saying skip foo sounds (sort of) like you're telling it to skip the next iteration of foo.

I submit pass, which has precedence as a keyword from Python (though with a different meaning here).

@graydon
Copy link
Contributor

graydon commented Apr 18, 2012

We talked about this on IRC yesterday and stumbled into the pleasing possibility of making loop; on its own (no following brace) be the expression for continuing-to-loop. I kinda like that. One fewer keyword!

@jsternberg
Copy link
Contributor

I think overloading loop to have two different meanings is confusing. I also don't like the idea of using pass as a keyword for this specific use, because, as Wensleydale said, pass means something completely different in Python (if that's the intended reason to use that keyword). I also don't think it really addresses the original problem (pass foo is just as weird as skip foo).

I do like the skip keyword. I think it pretty clearly says what the keyword is doing.

@boggle
Copy link
Contributor

boggle commented Apr 20, 2012

Opinions on resume (I know one char too long)? Don't mind using skip either but resume has the precedence of having been used for continue in BASIC.

@brson
Copy link
Contributor Author

brson commented Apr 20, 2012

I like resume better than skip, pass, and loop. I'm also thinking that continue isn't bad and maybe this 5-character rule is hurting us by forcing us to pick worse and worse keywords.

@mitsuhiko
Copy link
Contributor

I honestly think the short keywords are hurting rust. log already conflicts with very common function names, same with next. prev/next are very common function names or properties (linked lists come to mind).

@bstrie
Copy link
Contributor

bstrie commented Apr 24, 2012

@mitsuhiko #554 could turn log into a syntax extension, in which case it would invoked as #log and would no longer collide with user-defined functions.

@brson
Copy link
Contributor Author

brson commented Jun 13, 2012

OK this is a trivial change to make but we don't have a clear consensus - I'm not even sure there's consensus that we want to change cont. There seem to be a lot of preferences for skip. My current preference is for continue.

@graydon
Copy link
Contributor

graydon commented Jul 4, 2012

My preference lies with loop since it's already reserved and we're in a keyword-cutting mood. next is my next choice, but the collision with other identifiers is legitimate (unless our keywords are to become contextual, somehow; but I think this context is pretty unavoidable).

How about again?

@nikomatsakis
Copy link
Contributor

I like loop too.

@kingcons
Copy link

kingcons commented Jul 5, 2012

I like loop. Hell, you could do "recur" if you really felt like it...

@kud1ing
Copy link

kud1ing commented Jul 5, 2012

On Reddit someone suggested Perl’s "redo".

@jsternberg
Copy link
Contributor

I don't like redo. redo implies your repeating something instead of iterating (which is what continue does).

@graydon
Copy link
Contributor

graydon commented Jul 6, 2012

We're going to go with 'again'. Did some surveying and it's the least-objectionable one that fits in the length rule.

@ghost ghost assigned graydon Jul 6, 2012
@anacrolix
Copy link

next from Perl? Perl also has last (like break).

@graydon graydon closed this as completed in c26d025 Jul 9, 2012
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
Add cache location on windows to documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests