I start to suspect my attempt to 'enhance' ComptimeStringMapto return an
interface is currently not possible, since if I understand correctly,
Zig dosn't have first-class functions yet. Which is probably why it
returns a struct as 'type'. Learning :)
Just a thought, any plans to add a comptime allocator? I managed to
avoid allocators everywhere so far, but a comptime one might be useful
for these sort of comptime data structures?
On 30/08/2022 13:39, Peter Bridge wrote:
> PS I realised that this is more like a singleton initialiser, not a
> constructor. Since a constructor could be solved by creating the
> state within the init fn call.
>> But when I go back to the original 'crux' line of code, first it
>> complains it has to be constant because of 'type', but const cant be
>> re-assigned... So now the problem is probably outside of Zig
>> language support, since this suddenly feels like a missing
>> constructor, or attempt at lazy/lateinit of a comptime/const.