[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add 'bytevector-slice'.

From: Maxime Devos
Subject: Re: [PATCH] Add 'bytevector-slice'.
Date: Sat, 14 Jan 2023 15:45:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

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


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.’


Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]