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

figure out what to do with iterators #556

Closed
espindola opened this issue Jun 23, 2011 · 1 comment
Closed

figure out what to do with iterators #556

espindola opened this issue Jun 23, 2011 · 1 comment

Comments

@espindola
Copy link

We would like to keep the ability of using yield instead of creating iterator "objects". One way to implement it with llvm that we discussed is that


iter f() {
yield 1;
yield 2;
}

...
for I in f() }
if I == 1 {
ret 42;
}
}

...

Gets compiled to (pseudo code)

{act, i32} the_for_body (i32 I) {
if (I == 1)
ret ActRet, 42
ret ActContinue, undef
}

Act,i32 f(B) {
x1,v1 = B(1);
if x1 == ActRet {
ret x1,v1
} else if (x1 == ActBreak) {
ret ActBreak, undef
}
x2,v2 = B(2);
if x2 == ActRet {
ret x2,v2
} else if (x2 == ActBreak) {
ret ActBreak, undef
}
ret ActBreak, undef
}

and the for loop becomes a call:

x, y = f(the_for_body);
if x == ActRet {
ret x;
}

@marijnh
Copy link
Contributor

marijnh commented Oct 21, 2011

For 0.1, iterators are out. We'll allow Ruby-style block parameters, and remove support for iter, for each, and put.

@marijnh marijnh closed this as completed Oct 21, 2011
mzabaluev added a commit to mzabaluev/rust that referenced this issue Feb 3, 2015
New functions, slice::from_raw_parts and slice::from_raw_parts_mut,
are added to implement the lifetime convention as agreed in RFC PR rust-lang#556.
The functions slice::from_raw_buf and slice::from_raw_mut_buf are
left deprecated for the time being.
mzabaluev added a commit to mzabaluev/rust that referenced this issue Feb 3, 2015
The lifetime of the resulting reference is freely inferred as
per RFC PR rust-lang#556.

[breaking-change]
mzabaluev added a commit to mzabaluev/rust that referenced this issue Feb 5, 2015
New functions, slice::from_raw_parts and slice::from_raw_parts_mut,
are added to implement the lifetime convention as agreed in RFC PR rust-lang#556.
The functions slice::from_raw_buf and slice::from_raw_mut_buf are
left deprecated for the time being.
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 10, 2015
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add FIONREAD for apple/b64

Adds the FIONREAD constant for macos/x86_64 machines.
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 27, 2024
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

2 participants