winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.03k stars 198 forks source link

Support calling async methods from initializers of inflight classes #2765

Closed eladb closed 1 year ago

eladb commented 1 year ago
          > We have a a problem with our async programming model in inflight classes because there is no way to indicate that a method is async. For now, all methods are async (since they are tagged inflight), but that means we cannot call them from within the constructor. We need to decide how to deal with it.

If inflight scopes are always async (and inflight classes can only be instantiated in inflight scopes), then couldn't we emit code like this each time an inflight class is constructed?

let a = new A();
await a.$inflight_init(); // allowed to call async methods

Originally posted by @Chriscbr in https://github.com/winglang/wing/issues/2677#issuecomment-1570564765

github-actions[bot] commented 1 year ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

staycoolcall911 commented 1 year ago

@yoav-steinberg - I believe this issue duplicates #4290 - please reopen in case you disagree