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

Remove fn expressions #3677

Closed
nikomatsakis opened this issue Oct 6, 2012 · 3 comments
Closed

Remove fn expressions #3677

nikomatsakis opened this issue Oct 6, 2012 · 3 comments
Assignees
Labels
A-typesystem Area: The type system C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Milestone

Comments

@nikomatsakis
Copy link
Contributor

Expressions like fn(S) { ... } are deprecated in favor of |s| t. I have a patch removing them and also implemented #3320 (better inference) but it is blocked on #2263.

@ben0x539
Copy link
Contributor

ben0x539 commented Oct 7, 2012

fn expressions currently seem to permit return, allowing for gross little things like short-circuiting out of a loop yielding a value without declaring a proper, non-anonymous function. Is that use deprecated too?

@nikomatsakis
Copy link
Contributor Author

Presumably. I could imagine loosening the "no return in ||" rule to something like "no return when using the do keyword", or perhaps even looser like "no return when using the do keyword and a stack closure". @pcwalton has complained about this restriction annoying him; it's saved me a few times, though, when I threw in a "do foo { ... }" around a block of code that contained a return (and which would therefore no longer have returned as I expected).

@pcwalton
Copy link
Contributor

pcwalton commented Mar 8, 2013

Done.

@pcwalton pcwalton closed this as completed Mar 8, 2013
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

3 participants