4 ms·
I'm curious about the example code at https://vlang.io/compare https://vlang.io/compare (apologies if you answered this before): - Does the compiler use escape
by oconnor663 7y ago
I'm curious about the example code at https://vlang.io/compare https://vlang.io/compare (apologies if you answered this before):
- Does the compiler use escape analysis to determine that the `cursor` variable needs to be heap allocated? If not, how does it know that the worker threads won't outlive the stack frame that owns `cursor`? If so, when does the allocation get freed? And does implicit heap allocation conflict with the goal of being as fast as C?
- How does the compiler know that the `lock` block is the only code that touches `cursor`? Does it still work if the `lock` block is in a subroutine? Does that require whole-program analysis? If two different `lock` blocks touch the same variable, are they implicitly a single `lock`?
- kbd 7y agoThe two languages I'd be most interested in seeing added to that comparison are Nim and Zig. Those definitely have most of my mindshare on "new low-level/efficient languages simpler than Rust".