You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't see a clear way to implement callables that are async. In my case I'm using a Dart implementation and I'm even willing to restrict the async functions to the globals (so all are predefined), say to get some data from a database. However, the visitCallExpr will return a Future that I can't await properly to preserve the sequential nature of a Lox script.
if you want the async nature of the call to be hidden from lox then you will need to implement some coroutine functionality
So you will need to be able to yield from the interpreter where the stack gets preserved and restored on the next resume.
Or you can use the built in async/await you need to detect whether the return of a function is a Future and instead of returning it you need to await it (and make the entire interpreter callstack stack up to that point async)
Hi,
I don't see a clear way to implement callables that are async. In my case I'm using a Dart implementation and I'm even willing to restrict the async functions to the
globals
(so all are predefined), say to get some data from a database. However, thevisitCallExpr
will return a Future that I can't await properly to preserve the sequential nature of a Lox script.For example, a global async function:
called from the Lox script
will print
Instance of Future<int>
, etc.If you can share any tips for a possible implementation it would be much appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: