On Saturday, 21 October 2017 at 18:52:15 UTC, bitwise wrote:
On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:

async/await (vibe.d is nice but useless in comparison to C# or js async/await idiom)


Reference counting when we cannot use GC...


If I understand correctly, both of these depend on implementation of 'scope' which is being worked on right now.

Scope is about preventing pointer escaping, ref-counting also needs to make use-after-free safe which is currently in the early spec phase. Whether or not that is going to be a compile-time or runtime check has yet to be figured out. If you have a great idea that we should consider, let us know.

The recent IOPipe window invalidation discussion was a good example of what such a mechanism would hopefully be able to handle (https://gist.github.com/MartinNowak/b406a6b7aa6d0964147c107771b64333#file-safety_dance-d-L43-L45).

I think reference counting needs 'scope' to be made safe. RC also benefits from scope in that many of the increments/decrements of the ref count can be elided. The performance gain can be significant, and even more so when you use atomic reference counting (like C++ shared_ptr) for thread safety.

Well, there can be RC and shared(RC), only the latter would need to do atomic ref-counting.

Async/Await needs to allocate state for the function's local variables. When it's detected that the function's state/enumerator won't escape it's current scope, it can be put on the stack, which is a pretty big optimization.

We should figure out how to allocate RC/unique delegate contexts.
Not that with async/await you always escape the local context, as it's the callback in the returned Promise/Task.

Reply via email to