interaction between multiple return and variadic functions

107 views
Skip to first unread message

Vitalii Solodilov

unread,
Oct 11, 2020, 10:48:05 PM10/11/20
to golang-nuts
Hello.
Where can I find an explanation of the interaction between multiple return and variadic functions?

I've just mentioned that Goland IDE doesn't highlight the third line of the main function as an error. Before issue submission, I wanna check other cases if there are.

Brian Candler

unread,
Oct 12, 2020, 2:55:42 AM10/12/20
to golang-nuts
https://golang.org/ref/spec#Calls

"As a special case, if the return values of a function or method g are equal in number and individually assignable to the parameters of another function or method f, then the call f(g(parameters_of_g)) will invoke f after binding the return values of g to the parameters of f in order. The call of f must contain no parameters other than the call of g, and g must have at least one return value. If f has a final ... parameter, it is assigned the return values of g that remain after assignment of regular parameters."


Vitalii Solodilov

unread,
Oct 12, 2020, 9:01:42 AM10/12/20
to golang-nuts
Thanks, Brian.
Reply all
Reply to author
Forward
0 new messages