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

[ cleanup ] Make makeFuture to be %foreign, not %extern #3341

Merged

Conversation

buzden
Copy link
Contributor

@buzden buzden commented Jul 1, 2024

Description

System.Future in contrib is strange, especially because it relies on two backend-specific functions, prim__makeFuture and prim__awaitFuture which are very different: the first one is a special primitive function that compiler is aware of, when the second one is a normal %foreign function. The main reason for this was the desire to pass Lazy value into the foreign function, which is not supported (for good reason, I think), so it was made a primitive.

But I think that this was, basically, the XY-problem -- we actually wanted to pass not a Lazy value of type a, but a function that returns a when demanded -- in general case, semantics of Lazy values may differ, but semantics of this call does not. Also, it is pretty disgusting that we have a compiler primitive that is excersised only in contrib. Also, this siituation leads to problems like #3292.

So, I propose the change which makes both basic functions in this module be declared as %foreign, thus removing the MakeFuture primitive from the compiler.

Should this change go in the CHANGELOG?

  • If this is a fix, user-facing change, a compiler change, or a new paper
    implementation, I have updated CHANGELOG_NEXT.md (and potentially also
    CONTRIBUTORS.md).

@gallais gallais merged commit c5abf4b into idris-lang:main Jul 2, 2024
22 checks passed
@buzden buzden deleted the harmonize-make-and-await-of-futures branch July 2, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants