Many happy returns

“Some languages can return multiple values from a function, just as they can pass multiple arguments to a function. I used to think this was an important language feature. Functions that return more than one result are common, after all, so every language has a way to express them — by returning structures, or side-effecting reference parameters, or CPS — or, instead of these workarounds, by supporting multiple return values directly. It complicates the language kernel a little, but it makes code cleaner, right?

No, it doesn’t. There are several reasons for a function to return multiple values. None of them require direct language support, and for most of them, it’s not even helpful…”

http://arcanesentiment.blogspot.com.br/2016/01/many-happy-returns.html

Advertisements