|
|
@@ -424,6 +424,13 @@ var immutableKindsSet = [32]bool{
|
|
|
// Consequently, during (en|de)code, this takes precedence over
|
|
|
// (text|binary)(M|Unm)arshal or extension support.
|
|
|
//
|
|
|
+// By definition, it is not allowed for a Selfer to directly call Encode or Decode on itself.
|
|
|
+// If that is done, Encode/Decode will rightfully fail with a Stack Overflow style error.
|
|
|
+// For example, the snippet below will cause such an error.
|
|
|
+// type testSelferRecur struct{}
|
|
|
+// func (s *testSelferRecur) CodecEncodeSelf(e *Encoder) { e.MustEncode(s) }
|
|
|
+// func (s *testSelferRecur) CodecDecodeSelf(d *Decoder) { d.MustDecode(s) }
|
|
|
+//
|
|
|
// Note: *the first set of bytes of any value MUST NOT represent nil in the format*.
|
|
|
// This is because, during each decode, we first check the the next set of bytes
|
|
|
// represent nil, and if so, we just set the value to nil.
|