iterator_item icon indicating copy to clipboard operation
iterator_item copied to clipboard

A mix between your initial syntax and RFC 2996

Open lqd opened this issue 3 years ago • 1 comments

Here's another quick test :)

Your & javascript's fn* + RFC 2996 (and regular rust) return types syntax.

fn* foo() -> i32 {
    for n in 0i32..10 {
        yield n;
    }
}

And for fun, something more involved (but not as involved as parsing invalid syntax as if it were valid): a simile yield from some_iterator; — made easier to parse with yield #[from] some_iterator;.

Making the first example expressible as:

fn* foo() -> i32 {
    yield #[from] 0i32..10;
}

(and only for sync code, not async generators)

lqd avatar Nov 06 '21 22:11 lqd

Which reminds me: you mentioned for await in it here but IIUC from this test above, syn won't be able to parse that and visit that node at this location ?

lqd avatar Nov 09 '21 19:11 lqd