>
> IMO implementing such a compile check would be contrary to the "least
> WTF" principle. Imagine something like
>
> type S struct {
> f func()
> }
>
> func (s S) Impl() {}
>
> func Foo() I {
> return S{}
> }
>
> m[Foo()] = true
>
> The compiler is able to check at compile time that Foo always returns
> values of the dynamic type S but that would unnecessary complicate the
> analysis.
>
That's not what's being discussed here; the type of the value used to index
m in your example is I. You need further analysis to work out that it's
actually S{}
This discussion is restricted to cases where the type is known, by simply
type checking alone, to be un-comparable.
--
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.