4 ms·
Language support for functions that return multiple values
- deleted 11y ago[deleted]
- prestonbriggs 11y agoI've always liked Beta's approach to assignment, calls, and returns (whilst disliking most of the rest of its syntax, sigh). Assignments work left to right, approximately like this: (x, y) => (y, x) which swaps x and y. Calls that return multiple values look like x => sincos => (sinx, siny) and we can string together all sorts of things like this x => sincos => sum => y Procedures looked something like sincos(double x) { ... } returns (sinval, cosval) All this syntax is pretty approximate, but perhaps you'll get the idea. To me, it seemed attractive in that a tuple of values flowed in at the top of a procedure, then left to right on each line, and top to bottom between lines, and finally a tuple of values is returned. Seemed like a natural sugaring of CPS style.
- frozenport 11y agoReturning multiple values is not atomic.
- tomcam 11y agoPray explain further?
- gsg 11y agoThe two-continuation style suggested there is familiar to me under the name "double barreled CPS", although usually in the context of compilation. Interesting to see it suggested for user code.