RustPython icon indicating copy to clipboard operation
RustPython copied to clipboard

Compilation for `async for` comprehensions is not yet implemented

Open coolreader18 opened this issue 4 years ago • 5 comments

i.e. [x async for y in z]. There's an unimplemnted!("async for comprehensions") in compiler/src/compile.rs, which is where an implementation could start out. Take a look at how normal compile_for works for async and how compile_for's non-async implementation is structured somewhat similarly to compile_comprehension.

coolreader18 avatar Mar 02 '21 05:03 coolreader18

@coolreader18 I'm looking into this, not committing to when I can implement it. However, I was wondering if there was a good guide for the Instruction enum? I can generally get an idea for each operation. However, I have never really worked on a programming language, so a guide, definition, or something would be amazing.

aaronclong avatar Mar 04 '21 02:03 aaronclong

@aaronclong ah, we don't really have that, the closest thing would be doc comments on the enum variants but there aren't many. That's definitely something to improve. However, you can check the CPython docs for the dis module, we share many of the same instructions (although renamed to CamelCase, obviously) and you can usually check how CPython compiles things using dis.dis() for inspiration for how to do it in our compiler

coolreader18 avatar Mar 04 '21 05:03 coolreader18

If no one is working on this issue, can I take this issue?

HyeockJinKim avatar Aug 07 '21 08:08 HyeockJinKim

@aaronclong are you available to finish this up?

DimitrisJim avatar Aug 07 '21 09:08 DimitrisJim

#5276 adds basic async for comprehension support. but still missing lots of features. Including compile error (test_asyncgen.test_async_gen_expression_02) and runtime error (test_asyncgen.test_async_gen_expression_01)

youknowone avatar Apr 25 '24 11:04 youknowone