On 14-01-2023 00:48, Ludovic Courtès wrote:
Ah yes, that’s right, I misunderstood the comment.

In the example above, where we’re only dealing with slices, we could
“skip” the parent (i.e., have each slice’s parent point to the “root” of
the hierarchy), but I don’t think we can assume this to be the case
generally.

Ludo’.

Why not? I.e., where would things go wrong it the parent is "skipped" in other cases? Something about GC I guess, but I don't follow what this "something" would be.

My guess is that you are thinking of the interaction with weak key-value maps, e.g. a map

   root-bytevector    -> stuff
   [other entries]

where the user might expect a slice of the root bytevector to keep the root itself intact -- which would be the case with your patch, but not with my "skip the parent" proposal.

I suppose there might be use cases for such things, in which case I wouldn't mind the original behaviour (though I'll have to look over Scheme-GNUnet code to verify no long chains are constructed), but if this is supposed to be supported, it should be documented. E.g.:

‘The returned slice keeps a reference to @var{bv} and not only to the underlying bytes of the bytevector. Usually, this is of no importance, but this information is relevant when using GC data structures such as guardians and weak hash tables.’

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to