4 ms·
This is all correct. I don't think it needs to be this way though. It could plausibly work in a way that doesn't make async functions special other than that th
by anonymoushn 5y ago
This is all correct. I don't think it needs to be this way though. It could plausibly work in a way that doesn't make async functions special other than that the compiler must calculate the size of the deepest stack they can use, and then TFA's code would work rather than not working. (Well, other than the thing where the author wanted to make a function that suspends only once, then call it, then resume it, the await it, which will never work by design)
- dundarious 5y agoPretty sure stack growth knowledge like this is on the Zig roadmap. Stack memory is a free-for-all in most languages, but in many domains, it's as crucial to manage as the heap.
- anonymoushn 5y agoA similar type of information is already recorded by the compiler for async functions to figure out how large their frames must be. So the proposed change would change the size of some frames but otherwise do nothing to most code.
- dundarious 5y agoCheers. I must admit I've completely ignored the async aspect of Zig for the time being, so I know nothing about how close or far it is from already doing enough of this work. Thanks for the info.