Are there serialization formats that support Go generics?

I'd like to take a look at how they do it, if they exist.

I'm wondering: Do they use reflection at runtime?

and/or: Do they parse the source looking for template instantiations at 
go:generate time
to codegen for all possible instantiations?

I've added some generics support to my serialization package, greenpack 
(https://github.com/glycerine/greenpack), and I'm curious what approaches 
exist.
I used to just skip generic structs, but now I serialize them and just skip 
the
fields that contain type parameters; there are pre/post load hooks that can
be used to manually add reflection code, if desired.

I'm thinking that (for automatic support) reflection at runtime for any 
generic fields is probably the only sane way to go; but I'd be glad to be 
aware of other possible approaches.

At the moment I parse the source code at go:generate time and look for 
instantiations of generics; using the first found instantiation to generate 
the automatic test code.

Thanks for any ideas.

Jason

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/13fd7b93-1a8e-4fd1-b20e-0da7c171d41dn%40googlegroups.com.

Reply via email to