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

Support Ruby-style block arguments #1054

Closed
marijnh opened this issue Oct 21, 2011 · 0 comments
Closed

Support Ruby-style block arguments #1054

marijnh opened this issue Oct 21, 2011 · 0 comments

Comments

@marijnh
Copy link
Contributor

marijnh commented Oct 21, 2011

uint::range(0, 10) {|x| ... };
mymap.each {|key, val| ...};

A block ({ followed by | or ||) appearing after an expression is (with the same precedence as x.y, x[y], x(), etc) treated as a block value passed to a function. If the expression was a call, the block argument is added as a last argument. If it was a non-call, it becomes a call with a single argument.

@ghost ghost assigned marijnh Oct 21, 2011
marijnh added a commit that referenced this issue Oct 21, 2011
@marijnh marijnh closed this as completed Oct 21, 2011
marijnh added a commit that referenced this issue Oct 21, 2011
This makes it possible to omit the semicolon after the block, and will
cause the pretty-printer to properly print such calls (if
pretty-printing of blocks wasn't so broken). Block calls (with the
block outside of the parentheses) can now only occur at statement
level, and their value can not be used. When calling a block-style
function that returns a useful value, the block must be put insde the
parentheses.

Issue #1054
@marijnh marijnh removed their assignment Jun 16, 2014
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2020
…#1054)

* Longer README about how to use this instead of `cargo run`

Resolves rust-lang#1052.

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Assume an x86_64 architecture for the machine model

* Add checks for arch spec/options

* Check platform instead of architecture

* Add debug statement

* print platform

* Use `starts_with` for apple platforms

* minor comment change

* Make code simpler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant