6 Control
6.1 What is This Assignment’s Purpose?
Modern languages now have interesting forms of control that go beyond traditional call-and-return, such as pausing the computation and being able to resume it. They make programs much more readable, elegant, and even performant.
Yet you may or may not have been exposed to these features before, and even if you have been, you may not have thought about them systematically. We want you to learn enough about these to compare and contrast them, so you have them in your toolbox when you program in the future.
6.2 Task
generators in Python
streams in Java 8
goroutines in Go
asynchronous functions in JavaScript
What are their relative similarities and differences, strengths and weaknesses? As a prompt, imagine someone approaches you saying they need to write a program that would benefit from these kinds of operators, and they have complete flexibility in language choice. How would you guide them to pick one of these? You may use whatever granularity is easiest: whether as one big table, or a sequence of (up to 6) pair-wise comparisons, or some combination thereof.
In your comparison, ignore all other aspects of the languages: assume
the rest of the language is identical, or that these features have been
transplanted to an otherwise identical base (like SMoL), as we did for
Mystery Languages. The only exception is if a feature from the rest of the
language—
You may use any Web resources you wish (within the rules set down in the syllabus). Be sure to credit them appropriately. But beware that many Web sites are written by authors who are underinformed or even wrong, so don’t just take them at their word! Trust but verify.