I am running into a problem with gob with some code. A simplified
example is here:
From the gob documentation:
"Pointers are not transmitted, but the things they point to are
transmitted; that is, the values are flattened. [...] Interface values
are transmitted as a string identifying the concrete type being sent
(a name that must be pre-defined by calling Register), followed by a
byte count of the length of the following data"
So, it is clear why decoding does not work: while encoding the only
slice member, the value is flattened. In the gob, Foo is stored and
not *Foo. During decoding, the assignability check fails, because
Frob() is implemented on Foo and not Foo. The decoding problem is
easily fixed by implementing Frob() on Foo.
But what if I actually only want to implement Frob() with a pointer
receiver? Wouldn't it make sense if gob tried if taking the address of
the value would fulfil the interface when the value doesn't fulfil the
interface? Or am I missing something?
Daniël de Kok
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@example.com.
For more options, visit https://groups.google.com/d/optout.