你们好,初次接触zig,对于它的协程实现有一些疑问 #218
Unanswered
npc1054657282
asked this question in
新手提问
Replies: 1 comment
-
这里有些最新的进展,不过也还没细看。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我看到zig的协程力图实现“非染色”的协程,因此比较感兴趣,进而简单地了解了一下这个语言。看起来这个语言是偏向于底层,追求0成本抽象和极致显式的哲学,因此我对于它的协程的逻辑上的约定实现细节比较好奇:
zig的协程的变量是什么时候出现在堆上的?对于0成本抽象与非染色的协程,我的理解是“一个返回future的函数”,如果是这样的解释的话,协程中创建的变量应该约定为在首次await之前都在栈上,而在首次await的时候将所有变量转移到堆中的函数帧上,我的理解正确吗?
Beta Was this translation helpful? Give feedback.
All reactions