On Fri, Jul 24, 2020 at 9:15 AM binary cat <
doged...@gmail.com> wrote:
>
> Doing `var F = Foo` (where `Foo` is a generic function) fails with an error like this: `prog.go2:21:9: cannot use generic function Foo (value of type func(type T1, T2)(fst T1, snd T2) Bar(T1, T2)) without instantiation in variable declaration`. Trying `var F = Foo[int,int]` fails with an error like `prog.go2:21:9: expected expression`.
>
> Personally, I think both of these should work (with the second being a version of `Foo` that only accepts two ints), but the first one definitely seems like an implementation error, as the first snippet works fine if `Foo` is a non-generic function.
A statement like "var F = Foo" can't work if Foo is a generic
function. What would be the type of F? All generic functions and
types must be fully instantiated at compile time.
"var F = Foo[int, int]" does work on the head of the dev.go2go branch.
Ian