Skip to content
This repository was archived by the owner on Sep 23, 2020. It is now read-only.

Implement Closure Capture #27

@LemonHX

Description

@LemonHX

我觉得我可以这样实现:

  • 首先用编译器确认这个闭包引用的变量的位置
  • 然后,把那个变量变成ref类型并扔到堆里
  • 最后在运行那个闭包的时候从堆里取出他的引用

难点:

  • 如果Async分支被合并就需要一个机制去确保堆里面信息的正确性(比如锁,STM
  • 改动堆里的值并不是引用而是拷贝,只要是被引用的变量都进堆。。。感觉有点浪费

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions