Wednesday, July 15, 2015

programming: Futures and promises (Go lang)

Futures and promises - Wikipedia, the free encyclopedia
"In computer science, future, promise, and delay refer to constructs used for synchronization in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown, usually because the computation of its value is yet incomplete."


"Go has the usual mechanisms for control flow: if, for, switch, goto. It also has the go statement to run code in a separate goroutine. Here I'd like to discuss some of the less common ones: defer, panic, and recover.

A defer statement pushes a function call onto a list. The list of saved calls is executed after the surrounding function returns. Defer is commonly used to simplify functions that perform various clean-up actions."




C++: GoingNative 39: await/coroutines | C9::GoingNative | Channel 9