🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Promise implementation proposal with C++20 co_await syntax

Started by
4 comments, last by romanpunia_gd 1 year, 1 month ago

Hello, Andreas or WitchLord (i could confused :D),

I have seen this post on AngelCode forum that i found interesting.

https://www.gamedev.net/forums/topic/709345-angelscript-amp-asyncawait/

I have had many cases where i needed to work with promises even within C++, when time came to AngelScript i saw that there was no implementation of that concept which is okay but i think that AngelScript provides very convenient way to implement it.

About a year ago i implemented concept of promises specifically for AngelScript, then modified it to support syntax that is adopted in JavaScript, in this case it is only one keyword await.

Today i have extracted minimal implementation from my codebase to separate repository and made a header-only implementation in 600 lines of code which is as small as i could get, basically a scratch.

It is a bidrectional implementation meaning can be used as script only promise that will be created and resolved inside script context, C++ to script, script to C++.

Further modifications would be done if needed. It's pretty customizable and uses AngelScript memory functions. More information could be found in this repository.

https://github.com/romanpunia/aspromise

Check it out please when you could.

Advertisement

Hi roman,

Either Andreas or WitchLord works. Though, nowadays I prefer Andreas

Thanks a lot for sharing this. I only looked at it quickly, but looks good to me. I'll make sure to add a link on the further resources page on angelcode.com so others can easily find it too.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks, Andreas.

This repository will be maintained.

The link is now added to the resources page:

http://www.angelcode.com/angelscript/resources.html

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I appreciate it, Thanks.

Will add documentation next week and make it into a fully drag-and-drop solution.

This topic is closed to new replies.

Advertisement