Skip to content
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

Type safety / static async check #22

Open
fed239 opened this issue Feb 2, 2022 · 1 comment
Open

Type safety / static async check #22

fed239 opened this issue Feb 2, 2022 · 1 comment

Comments

@fed239
Copy link

fed239 commented Feb 2, 2022

Would it possible to do so that when @async is used with a function, its type is change, so if @await is not used when calling the function type checking would fail?

Example

@async function returnZero(): Int {
  return 0;
}

var i: Int = @await returnZero(); // compilation succeeds
var p: Promise<Int> = returnZero(); // compilation succeeds
var i2: Int = returnZero(); // compilation fails
@botsman
Copy link
Owner

botsman commented Feb 2, 2022

I've tried to implement type checking, but did not manage to do that, unfortunately.
I guess that I am not good enough with Haxe macro system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants