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

Add ability to specify a function doesn't need args fully resolved when used inside let-flow #203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanzoniteblack
Copy link
Contributor

Some functions, like d/alt are designed to handle deferrables as arguments. let-flow
shouldn't wait on args to functions like these to have been resolved before invoking the function.

With this change set, all the functions inside manifold.deferred that are designed to work with
deferrables will now behave as "expected" inside a let-flow block. Users can mark their own
functions with the metadata manifold.deferred/deferred-args to have let-flow treat those the
same way.

Addresses #183

N.B. This includes the changes from #202 , which I've done to not cause merge conflicts between the two change sets.

…side `let-flow`

Some functions, like `d/alt` are designed to handle deferrables as arguments. `let-flow`
shouldn't wait on args to functions like these to have been resolved before invoking the function.

With this change set, all the functions inside `manifold.deferred` that are designed to work with
deferrables will now behave as "expected" inside a `let-flow` block. Users can mark their own
functions with the metadata `manifold.deferred/deferred-args` to have `let-flow` treat those the
same way.
@KingMob KingMob self-requested a review July 19, 2021 23:36
Comment on lines +148 to +149
(is (>= 200 (- (System/currentTimeMillis) start))
"Alt in body should only take as long as the first deferred to finish."))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can make this change for let-flow bodies, only bindings. The docstring explicitly says "The body will only be executed once all of the let-bound
values, even ones only used for side effects, have been computed.", and some users may be relying on that.

More generally, an alt in the body only makes sense if some of its arguments aren't bound in the let-flow. If all of them are, then it's essentially random, which is fine, but may not be what they expect.

@KingMob
Copy link
Collaborator

KingMob commented Mar 9, 2023

Also related to #141

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

Successfully merging this pull request may close these issues.

2 participants