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

refactor: parentheticals KISS #4900

Merged
merged 19 commits into from
Feb 17, 2025
Merged

Conversation

ggreif
Copy link
Contributor

@ggreif ggreif commented Feb 14, 2025

KISS: keep it simple, stupid

This refactors the lowering of parentheticals for sends to simply assign to backend variables. So we piggy-back on the imperative mechanism instead of running the parenthetical through all the IR and backend hoops.

Maybe later we have to remove this shortcut, but for now it should work.

Thanks to @crusso for suggesting!

@ggreif ggreif self-assigned this Feb 14, 2025
@ggreif ggreif changed the base branch from master to gabor/parentheticals February 14, 2025 17:34
@ggreif ggreif changed the title Gabor/parentheticals kiss refactor: parentheticals KISS Feb 17, 2025
src/lowering/desugar.ml Outdated Show resolved Hide resolved
src/lowering/desugar.ml Outdated Show resolved Hide resolved
src/lowering/desugar.ml Outdated Show resolved Hide resolved
@@ -2584,8 +2584,8 @@ and validate_parenthetical env typ_opt = function
| _ -> ()
end;
let [@warning "-8"] par_infer env { it = ObjE (bases, fields); _ } =
let checked = T.[ { lab = "cycles"; typ = nat; src = empty_src}
; { lab = "timeout"; typ = nat32; src = empty_src}
let checked = T.[ { lab = "cycles"; typ = nat; src = empty_src }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

move to type.ml

@ggreif ggreif marked this pull request as ready for review February 17, 2025 16:10
@ggreif ggreif requested a review from a team as a code owner February 17, 2025 16:10
src/ir_def/construct.ml Outdated Show resolved Hide resolved
Copy link
Contributor

@crusso crusso left a comment

Choose a reason for hiding this comment

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

Skimmed and looks ok, but I'll leave the proper review for the merge.

Also, do we really want to reset the @cycles to zero in desugar.ml when the cycles field is absent. At least, do we want to this before we've actually removed ExperimentalCycles.add altogether?

@ggreif
Copy link
Contributor Author

ggreif commented Feb 17, 2025

Also, do we really want to reset the @cycles to zero in desugar.ml when the cycles field is absent. At least, do we want to this before we've actually removed ExperimentalCycles.add altogether?

Yes, I think we should not have a mixture of both approaches. Either have a parenthetical or Cycles.add. Makes it simpler to get rid of the latter when we deprecate it.

@ggreif ggreif merged commit c92df25 into gabor/parentheticals Feb 17, 2025
3 of 5 checks passed
@ggreif ggreif deleted the gabor/parentheticals-kiss branch February 17, 2025 16:55
@crusso
Copy link
Contributor

crusso commented Feb 17, 2025

Oh, ok, so the old mechanism still works on sends without parenthetical, right?

Seems sensible.

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