New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async/await syntax #2958
Comments
Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue. |
Hello! I guess this will be done in multiple steps for Objective-J. As it is a superset of Javascript we first need to support ECMAScript 2017. When that is done we can start incorporate it to the Objective-J language. With that said, do you have any ideas or suggestions that you want in the language? |
For me would be easier to make everything async. But then quite many assumptions ruin. Handler may semi-execute when handling DOM event, and then next DOM event comes in between. But we cannot let handler fire. The environment becomes "multithreaded" otherwise. I rely on Cappuccino to do the heavy lifting now, and the same way I would rely on Cappuccino to simulate "single main thread" while making all methods async. DOM elements must collect events or ignore them when "single main thread" is busy. That is, I guess, a serious architecture change. In the short run I propose explicit async/await. Maybe Third possible solution is based on making everything async, but instead of enabling long-running handlers, denying them to run long. DOM event handlers must enter scheduler, which is to replace So Objective-J event handler can launch several CPThreads, and all of them may possibly use long-running functions. Objective-J event handler "in the main thread" may possibly try to wait for their completion, and indeed all may end fast, thanks to the scheduler. But if not, if some threshold is passed or if scheduler is out of work (all threads "await" something that is not going to happen soon), Objective-J event handler is woken up with failure or exception. This approach does not require big UI architecture changes. |
maybe we can/should integrate this with CPOperationQueue somehow? |
Swift Evolution is now discussing async/await) including interoperability with Objective-C and its runtime (under Related Proposals). Having a |
We have to keep things separate. I can at least find these topic in this interesting discussion:
With this said I think this issue should be about 1. Add async/await support in the Objective-J language. Feel free to open new issues for the other issues. Really interesting topics |
-#new |
Milestone: Someday. Label: Objective-J. What's next? A reviewer should examine this issue. |
@mrcarlberg is this still an issue? |
Yes, I believe issue 1. above is fixed in the Node version when |
@mrcarlberg i think we can close this one. as you said we can open new issues for the Web Worker stuff as needed. do you agree? |
Hello!
With async/await we are finally (almost) able to write clean synchronous-style browser code. But Objective-J did not incorporate it in any way IIUC.
It is not an easy move, but what are the plans about it?
For instance, make all Objective-J methods implementations async, and all Objective-J method invocations await.
Or, like in ordinary JavaScript, move the burden of memorizing who's async, who's not, and forcing to write await by hand. But at least this is already something.
The text was updated successfully, but these errors were encountered: