Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why not?

If the construct you propose were feasible, why do you think it doesn’t exist?

The reason is that it’s not feasible. Compositional pipelines involve constraints and properties that an imperative for loop doesn’t support.



> If the construct you propose were feasible, why do you think it doesn’t exist?

Because it already exists as a part of the Stream API in a way that doesn't change the language much: since you can mostly use .parallelStream() or .stream().parallel() there's basically no need for the "old" syntax to enable the same functionality.

That doesn't mean that it's somehow unfeasible, since the implementation of the example "parallel for" construct would just need to execute the code in the loop body with a ThreadPool. The Ada language has a nice example of parallel loops like that https://ada-lang.io/docs/arm/AA-5/AA-5.5#p26

Of course, there are other benefits to streams and lazy evaluation, but perhaps that's besides the point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: