[generics] Bugs + something else

212 views
Skip to first unread message

p...@pjebs.com.au

unread,
Aug 31, 2020, 8:49:00 PM8/31/20
to golang-nuts
1. 

Why can't I use square brackets when calling the constructor?

2. Variadic `any` types + allowing a called function() to be used as an argument + return arguments types and numbers based on input arguments

I want to implement a `must` function which I proposed here: https://github.com/golang/go/issues/32219

Based on the current generics proposal, I don't seem to be able to do so.
Am I missing something or is must outside its ambit?


-@pjebs

Ian Lance Taylor

unread,
Aug 31, 2020, 11:35:59 PM8/31/20
to p...@pjebs.com.au, golang-nuts
On Mon, Aug 31, 2020 at 5:49 PM p...@pjebs.com.au <p...@pjebs.com.au> wrote:
>
> 1.
> For this Go 2 snippet: https://go2goplay.golang.org/p/vbfBBmjxaMi
>
> Why can't I use square brackets when calling the constructor?

Sorry, the Go 2 playground isn't fully up to date.


> 2. Variadic `any` types + allowing a called function() to be used as an argument + return arguments types and numbers based on input arguments
>
> I want to implement a `must` function which I proposed here: https://github.com/golang/go/issues/32219
>
> Based on the current generics proposal, I don't seem to be able to do so.
> Am I missing something or is must outside its ambit?

The current design draft does not support variadic type parameters.
Maybe someday.

Ian

Jake Montgomery

unread,
Sep 1, 2020, 12:12:35 PM9/1/20
to golang-nuts

On Monday, August 31, 2020 at 8:49:00 PM UTC-4, p...@pjebs.com.au wrote:
1. 

Why can't I use square brackets when calling the constructor?
 
This seems  to be fixed now: https://go2goplay.golang.org/p/cpKKg5qG5Ve

Anderson Queiroz

unread,
Sep 2, 2020, 4:48:58 AM9/2/20
to golang-nuts
you cannot mix parenthesis and square brackets for type parameters in the same file, you did it on your first example.
Reply all
Reply to author
Forward
0 new messages