3 ms·
You can emulate closures with anonymous structs. struct { fn foo() { /**/ } }.foo If you want closures that capture values, you just need to d
by dist1ll 4y ago
You 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).