News for hackers. Stuff that matters.
Re:Jackson structured programming by nyanpasu64 on Friday August 13, 2021 @07:35AM (#28167721)
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.
Re:Jackson structured programming by dkarl on Friday August 13, 2021 @08:08AM (#28167912)
A 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.
Re:Jackson structured programming by danielnicholas on Friday August 13, 2021 @10:39AM (#28169455)
That'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.
Re:Jackson structured programming by scott_s on Friday August 13, 2021 @12:02PM (#28170674)
Or 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.