Hacker News new | ask | show | jobs
by luhn 3850 days ago
How would that work? My understanding of async is that it's a way of interacting with IO. So how would the examples you give (additional, while loops) behave asynchronously, since they don't involve IO? (Except for maybe memory IO..?)
1 comments

Addition still takes time though doesn't it? The idea is I could start an addition operation, and then be notified in some way when it's done.

I think the idea most similar to what the grandparent wants is instruction-level dataflow, where programs are DAGs, and instructions are only run when their inputs are ready, rather than when a program counter reaches them.

Physical dataflow machines were built that did this in hardware.

> programs are DAGs, and instructions are only run when their inputs are ready, rather than when a program counter reaches them.

At a low level, that's exactly what modern CPUs do.

https://en.wikipedia.org/wiki/Out-of-order_execution

Right, but only on a single core and only over a small sliding window. Real data flow machines made it explicit rather than a fragile optimisation and scaled it up.
True, though with multiple functional units there is some parallelism. Just thought it was an interesting comparison.
A program as a DAG.... Whoa. That's an interesting concept to try to wrap your mind around.
Just fyi, a library openstack (and myself and others) has created (in python) basically lets u program your workflow (really dataflow) as a DAG, and then the library will run it reliably (and in parallel and so-on). I'm more than willing to answer questions about how it does that if people are interested...

http://docs.openstack.org/developer/taskflow/

https://pypi.python.org/pypi/taskflow

And yes u can do things like built equation solvers to:

http://docs.openstack.org/developer/taskflow/examples.html#l...

And other neat things:

http://docs.openstack.org/developer/taskflow/#examples

That's exactly how Haskell's IO monad works (albeit a little simplified)