[Go2] Proposal remove function return type brackets

200 views
Skip to first unread message

Gert

unread,
Jul 23, 2017, 12:18:54 PM7/23/17
to golang-nuts
I personally don't think () is necessary for output types and is only confusing with the function attributes 

Example 

func Hello(b string) ([]byte, error) {
  ....
}

func Hello(b string) []byte, error {
  ....
}

func Hello(b string) a []byte, b error {
  ....
}

Feel free to counter argument against the proposal or if already proposed

Rémy Oudompheng

unread,
Jul 23, 2017, 1:24:16 PM7/23/17
to Gert, golang-nuts
With this proposal, can you tell whether the following function F
returns one argument (a function) or two arguments (a function and an
error) :

func F() func(string) []byte, error {
blah
}

Rémy.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Gert Cuykens

unread,
Jul 24, 2017, 3:56:59 AM7/24/17
to Rémy Oudompheng, golang-nuts
Valid argument thx
Reply all
Reply to author
Forward
0 new messages