Hi guys,

Thanks for the effort, it is much needed for quite some time. I really
appreciate the way of introducing the changes, go2go tool and open
discussion, so I wanted to review them and participate with feedback so you
can do the best job of understanding the world. With proposed changes, I
think extending language to support something similar to polymorphism might
be cheap.

Consider this go playground: https://go2goplay.golang.org/p/jqA4ccWeAKD.

Syntax is awkward currently (some syntax sugar is definitively needed), but
the point in the test below stands - you do have polymorphic slice, you can
use base fields and methods, and you can cast to the child structure (which
contains all the fields and methods from the base). json marshaling was
added to the example, json unmarshal could be implemented similarly, but in
that case we need provided mapping from base structure to the specialized
one, which can't be typed with current generics (for some of it,
interface{} and reflect would be needed). Could provide that example as
well, if needed.

Sending this idea as I think it might be interesting, and I think you might
get some more ideas out of it.

Aleksandar

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAG9NSAVMKL7FtkZURP0j4utts2Kya0RUvg2_qHCdxTE_JMii9g%40mail.gmail.com.

Reply via email to