1

Merge RFC 3513: Add `gen` blocks · rust-lang/rfcs@bc01ed8 · GitHub

 4 weeks ago
source link: https://github.com/rust-lang/rfcs/commit/bc01ed83c19bd96fdd2eb7b7c83c0f1e45f877a9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Commit

Permalink

Merge RFC 3513: Add gen blocks

Browse files Browse the repository at this point in the history

The FCP for RFC 3513 completed on 2024-03-23 with a disposition to
merge.  Let's merge it.
traviscross committed Apr 7, 2024
2 parents 0044bb7 + 22f7267 commit bc01ed8
Showing 1 changed file with 803 additions and 0 deletions.

803 changes: 803 additions & 0 deletions 803

text/3513-gen-blocks.md

2 comments on commit bc01ed8

It's a pity that this needs two keywords. Given that this will be fairly rare, a little more cumbersome syntax like yield in { … yield … } should be tolerable.

Or, if you go for postfix yield { … expr.yield … }.

Functions have no ambuiguty yield fn … { … expr.yield … }.

actually, i expect it to be relatively common, e.g. in python generators are pretty commonly used, I expect Rust to be somewhat similar

Please sign in to comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK