On Tue, Jan 12, 2021 at 12:29 PM Keith Wipf <
keith...@gmail.com> wrote:
>
> Also, will Go generics support specialization? I thought that I saw
> somewhere that you would be able to switch on a type parameter at
> compile time. I'm thinking you'd need this to serialize ints and other
> primitive types because you can't implement any serialize functions on
> those without making a new type.
The current type parameters design draft does not support
specialization. Specialization would significantly increase the
complexity, as it would be necessary to clearly define when a
specialization would apply.
In Go, serialization is more likely to be implemented using
reflection, as is done today, without generics, by packages like
encoding/json.
Ian