PeachPy icon indicating copy to clipboard operation
PeachPy copied to clipboard

Go: Support for multiple return values

Open robskie opened this issue 9 years ago • 6 comments

Will multiple return values be supported for Go?

robskie avatar Oct 09 '15 03:10 robskie

No plans for that

Maratyszcza avatar Oct 10 '15 02:10 Maratyszcza

Ok.

robskie avatar Oct 10 '15 04:10 robskie

Please leave the issue opened. Probably somebody else would want to implement it.

Maratyszcza avatar Oct 10 '15 19:10 Maratyszcza

Documentation:

Multiple return values in Go are passed on the stack after the arguments. They are addressed relative to FP. It seems that RETURN could be special-cased to take a tuple or a list, and then just assign to successive slots.

dgryski avatar Dec 04 '16 12:12 dgryski

@Maratyszcza @dgryski it would be great if it is supported. I want to write the sum of int64 slice with int64 overflow check. func AddInt64Slice(s []int64) (int64, bool) bool here will return if the overflow happened or not. In the meanwhile, is there a workaround for getting multiple return values from the function? is it possible to have dummy int64 slice as a function parameter and store the result like [int64sum, overflowstatus(0/1)]?

siddhesh503 avatar Aug 24 '21 06:08 siddhesh503

@siddhesh503 avo supports multiple return values (but of course requires that you port your asm code from peachpy to avo).

https://github.com/mmcloughlin/avo

dgryski avatar Aug 24 '21 06:08 dgryski