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

Syntax flaw: Async calls #1676

Closed
Hejsil opened this issue Oct 21, 2018 · 3 comments
Closed

Syntax flaw: Async calls #1676

Hejsil opened this issue Oct 21, 2018 · 3 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior.
Milestone

Comments

@Hejsil
Copy link
Contributor

Hejsil commented Oct 21, 2018

While trying to come up with a better solution for #760, I found this nice little syntactic ambiguity:

_ = async fn()void ();
// Two options:
// async (fn()void) ()
// (async fn()void) ()
@Hejsil
Copy link
Contributor Author

Hejsil commented Nov 13, 2018

This is not ambiguous as of #1685, but the rule for parsing this is a hack.

Just another note here. C# doesn't' use an async prefix to call async functions. What do we gain from having this prefix, once coroutines change?

I think it's a reasonable idea to not require special syntax at the callsite for async functions. The only thing it would do is document the calling convention at the callsite. However, I am now convinced that isn't useful. Because in order to know the return type of the function call, you need to look at the function prototype, which has the calling convention as well as the return type.

So from me to deleting async at the callsite.

@andrewrk andrewrk modified the milestones: 0.4.0, 0.5.0 Feb 8, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Aug 16, 2019
@andrewrk andrewrk added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label Aug 16, 2019
@andrewrk
Copy link
Member

The async function rewrite is complete but I believe this parsing hack still exists.

It's not clear to me why (async fn()void) () is an option. The syntax after async must be a function call.

In response to the previous comment, async functions can now be called with no async prefix. But they can also be called with an async prefix, which has different meaning.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 10, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 30, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@SpexGuy
Copy link
Contributor

SpexGuy commented Mar 20, 2021

Since async is now a calling convention on function declarations, and not allowed as a prefix, this is no longer ambiguous.

@SpexGuy SpexGuy closed this as completed Mar 20, 2021
@Vexu Vexu modified the milestones: 0.9.0, 0.8.0 Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior.
Projects
None yet
Development

No branches or pull requests

4 participants