It looks like it will treat it as generic type definition only if T is
not defined elsewhere:
https://play.folang.org/p/lN2b6QfgH38
* Commenting out const Size = ... -- results in an error about a missing
type parameter
* Deleting the Size constant and declaring a function named Size --
results in an error about the array size not being a constant.
I can't say I'm a fan of this behavior; right now you can parse Go
without knowing what variables are in scope.
I'll have to play with this some more though -- I've been at the point
where I don't feel like I have much more insight to gain just from
discussing hypothetical generics in Go, so being able to play with them
is very useful.
Quoting Mandolyte (2018-11-01 14:12:25)
> I didn't encounter this when I experimented with the package ([1]here).
> So not sure. However, as an array, T cannot be a variable, it must be a
> constant... so perhaps it can be figured out -
> see� https://play.golang.org/
> On Thursday, November 1, 2018 at 11:54:31 AM UTC-4, Ian Denhardt wrote:
>
> Quoting Mandolyte (2018-11-01 06:30:30)
> > - it uses square brackets instead of (type .. ) for the type
> parameters
> What does it do with `type Foo [T] int`? The draft design cites this
> ambiguity (is it a generic type with an unused parameter, or an
> array of
> length T?) as the reason for not using square brackets.
> (Note that Alan Fox proposed elsewhere using [type T] to declare
> type
> parameters as a solution, but it doesn't appear that Fo is doing
> this).
>
> --
> 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 [2][email protected].
> For more options, visit [3]https://groups.google.com/d/optout.
>
> Verweise
>
> 1. https://github.com/albrow/fo
> 2. mailto:[email protected]
> 3. https://groups.google.com/d/optout
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.