~andrewrk/ziglang

Re: static/comptime? map

Details
Message ID
<DBAP190MB09823C1D09D53C5EC1D301B6F9789@DBAP190MB0982.EURP190.PROD.OUTLOOK.COM>
DKIM signature
missing
Download raw message
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?

Cheers, Peter

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.
>
Reply to thread Export thread (mbox)