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

> errors are such an integral part of our programs, and have so much to do with flow control, that I don't believe thinking about errors just as values is enough

Exactly. The control flow. Both errors and asynchronous programming share the quality that they don't go well with our call/return based programming model(s). You have to return something, but you either don't have anything (error) or don't have something yet (async).

A great solution to this is to use dataflow. This decouples the logic, which is encoded in the dataflow, from the control flow, which just serves to drive the dataflow, and thus negotiable.

For async, it is synchrony-agnostic, which is nice, because it solves, or rather sidesteps, the "function colouring" problem. For errors, it allows you to keep error handling out of the happy path without needing exceptions.



Interesting. Can you give some pointers/examples?




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

Search: