3 ms·
I think coroutines, generators, and async allow the compiler to transform the two-loop version into a state machine that can be suspended at a readLine() or pri
by nyanpasu64 5y ago
I think coroutines, generators, and async allow the compiler to transform the two-loop version into a state machine that can be suspended at a readLine() or println() call.
- dkarl 5y agoA compiler that could take the JSP version and transform it into a streaming job with managed state would be pretty cool. Otherwise, a programmer has to construct the streaming architecture around the code, whether they integrate it into an existing framework like Flink or write all the state handling and management themselves. In that case the processing code has to be structured so that the state is explicitly passed in and out for each record.
- deleted 5y ago[deleted]
- danielnicholas 5y agoThat's exactly how JSP was used. In its first application to COBOL, the JSP-COBOL tool turned structured code into coroutining code with suspend/resume, and tools built later for JSD generated code to save state in a database.
- scott_s 5y agoOr use a language with generators and coroutines? I believe this would be natural to express in Python and (maybe) with C++20's coroutines. Java’s stream API could also probably accomplish something similar.