On Mon, Jun 13, 2016 at 2:17 PM,  <oli.gagnon4...@gmail.com> wrote:
> consider
>
>> func Foo(a int, b string, x SomeStruct)
>
>
> It would be nice if it was possible to pass in the "don't care" value,
> a.k.a. "_" as one of the argument, as an alias for the default value of the
> type.
>
>> pkg.Foo(a, b, _)
>
>
> This way if the user knows he doesn't care about the last value and that the
> default is fine. He can use that syntax to just give the zero value.
>
> This could be extended to returns
>
>> func Bar() (SomeStruct, error) {
>>
>> ...
>>
>> if err != nil {
>>
>> return _, err
>>
>> }
>>
>> ...
>>
>> }
>
>
> or things like channels
>
>> var c chan struct{}
>>
>> c <- _

I think this has been proposed before:

https://groups.google.com/d/msg/golang-nuts/VXWNJQFCgts/V2ED_W_tCdEJ
https://groups.google.com/d/msg/golang-dev/iAysKGpniLw/qSbtBUx4-sMJ
https://groups.google.com/d/msg/golang-nuts/kBOnfs3a2tU/YxTuqMLhYckJ
https://groups.google.com/d/msg/golang-nuts/Ii2rmcm483Q/H81jmL8reOIJ

Ian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to