3 ms·
Zig...
by speps 4y ago
Zig...
- lloydatkinson 4y agoOuch
- dist1ll 4y agoYou can emulate closures with anonymous structs. struct { fn foo() { /**/ } }.foo If you want closures that capture values, you just need to define the appropriate struct. I'm pretty sure with proper use of comptime reflection and custom allocators you can build pretty performant and ergonomic closures (albeit with a lot less memory and type safety of course).