[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)
From: |
Marc Nieper-Wißkirchen |
Subject: |
Re: [New module] Persistent Hash Array Mapped Tries (HAMTs) |
Date: |
Sun, 11 Oct 2020 19:32:18 +0200 |
Am So., 11. Okt. 2020 um 10:20 Uhr schrieb Marc Nieper-Wißkirchen
<marc.nieper+gnu@gmail.com>:
>
> Am So., 11. Okt. 2020 um 03:28 Uhr schrieb Bruno Haible <bruno@clisp.org>:
[...]
> > * hamt_lookup: If the caller is allowed to modify the payload stored in the
> > returned entry, this function should return a 'Hamt_entry *', not a
> > 'const Hamt_entry *'. Just like 'strchr' and 'strstr' return a 'char *',
> > not a 'const char *'.
>
> Unless the caller knows what it does, modifying the payload is not a
> good idea because the entry is shared between different hamts. If the
> caller really wants to modify the payload, it has to do an explicit
> type cast (which is safe).
I have noticed a problem with the current design: While an element can
be in more than one hamt (because copies of hamts are created through
various operations), an element cannot be actively inserted in more
than one hamt. The reason is that the reference counter of the element
is initialized whenever the element is inserted.
The way out is to expose the initialization function to the user, who
becomes responsible for initializing each element exactly once.
As soon as it is possible to insert an element more than once, another
observation will be made: The insert procedure does not accept a
pointer to a const element because it must be able to change the
reference counter internally. Thus it is more convenient if procedures
like hamt_lookup do not return const versions.
- Re: HAMT iterator, (continued)
- Re: HAMT iterators, Bruno Haible, 2020/10/11
- Re: HAMT iterators, Marc Nieper-Wißkirchen, 2020/10/11
- Re: HAMT iterators, Bruno Haible, 2020/10/11
- Re: out-of-memory handling, Bruno Haible, 2020/10/11
- Re: out-of-memory handling, Marc Nieper-Wißkirchen, 2020/10/11
- Re: out-of-memory handling, Bruno Haible, 2020/10/11
- Re: out-of-memory handling, Marc Nieper-Wißkirchen, 2020/10/11
- Re: HAMT for gl_set and gl_map, Bruno Haible, 2020/10/11
- Re: [New module] Persistent Hash Array Mapped Tries (HAMTs),
Marc Nieper-Wißkirchen <=
- Re: Draft #3 (with iterators), Marc Nieper-Wißkirchen, 2020/10/11
- Re: Draft #3 (with iterators), Bruno Haible, 2020/10/11
- Re: Non-opaque hamt type?, Marc Nieper-Wißkirchen, 2020/10/12
- Re: Non-opaque hamt type?, Bruno Haible, 2020/10/18
- Re: Non-opaque hamt type?, Marc Nieper-Wißkirchen, 2020/10/18
- Re: Non-opaque hamt type?, Bruno Haible, 2020/10/18
- Re: Non-opaque hamt type?, Marc Nieper-Wißkirchen, 2020/10/18
- Re: terminology, Bruno Haible, 2020/10/11
- Re: terminology, Marc Nieper-Wißkirchen, 2020/10/11
- Re: _Atomic, Bruno Haible, 2020/10/10