A data analyst and developer utilizing Power BI, M Query, Access, Excel, VBA, MySQL, SQLite, SQL, JavaScript, TypeScript and dabbling in Zig for future projects.
In response to your comment I added the following test which confirms your assertion that the presented implementation works only with compile time static values and my misunderstanding of Zig's comptime concept.
test"[Comptime Only Issue]"{// Test reuse invocation of the closure.varfrom:u32=undefined;varto:u32=undefined;from=2;to=5;constclosure=TextInRange(from,to);consttext=closure("0123456789");print("text = {s}\n",.{text});}
After further review of the presented implementation and a few minor changes to ClosureType and ClosureBind the above test passes using runtime variables. I'll update the article. Thanks for clarifying Zig's comptime concept.
For further actions, you may consider blocking this person and/or reporting abuse
In response to your comment I added the following test which confirms your assertion that the presented implementation works only with compile time static values and my misunderstanding of Zig's
comptime
concept.After further review of the presented implementation and a few minor changes to
ClosureType
andClosureBind
the above test passes using runtime variables. I'll update the article. Thanks for clarifying Zig'scomptime
concept.