-
Notifications
You must be signed in to change notification settings - Fork 833
Experiment: limited use synchronous stack guard #18966
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
Conversation
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
|
||
let FindUnsolvedStackGuardDepth = StackGuard.GetDepthOption "FindUnsolved" | ||
|
||
type SyncStackGuard(maxDepth) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its definitely an elegant way of changing behavior while minimizing risks and diff size.
A downside compared to hand-written, non-generic, usage directly in the processing function (e.g. just storing a Stack<Expr>
) is repeated closure for effectively the same argument set.
If that does not turn up being a visible issue, this could be a solution 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With slight adjustment It is possible to make it work with single closure and a Stack<Expr>
at the cost of more obscure application, for example:
SyncStackGuard.Guard cenv.stackGuard expr <| fun expr ->
instead of current, nicer
cenv.stackGuard.Guard <| fun () ->
EDIT: But that would still allocate a closure on each call. Just like the original StackGuard
(?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a closure would still be there, just without the surrounding params.
In that case I think the proposed version with same API, i.e. cenv.stackGuard.Guard <| fun () ->
is OK 👍
I think we can put this on hold, in favor of #18971 |
Description
Synchronous stack guard in
FindUnsolved.fs
.This only works on a unit-returning function.