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

Get rid of memoizing delay + switch to a strict store #1949

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Jun 17, 2024

Closes #1948; see that issue for a much more in-depth discussion.

Depends on merging #1928 first.

A lot of this PR consists in deleting code that is either (1) ugly or (2) overly clever! 🥳

The short version is that the Store used to incorporate some laziness + memoization: when a cell was first allocated, it was an unevaluated thunk; it then got evaluated the first time it was referenced. However, this wasn't really needed to handle recursive definitions (which is the only thing we were using it for). Getting rid of it means we can get rid of a lot of weird ugly code needed to wrap free variables in extra calls to force and so on.

The new and improved Store just stores Values, period. A special VBlackhole value was added, to be used while evaluating a recursive let.

Note that VRef is no longer really used, but I left it there for use in implementing #1660 . Once we have mutable references we can use them + delay/force to implement lazy cells.

@byorgey byorgey changed the title get rid of memoizing delay Get rid of memoizing delay + switch to a strict store Jun 17, 2024
@byorgey byorgey requested a review from xsebek June 17, 2024 12:25
Copy link
Member

@xsebek xsebek left a comment

Choose a reason for hiding this comment

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

This makes CESK much more approachable; I might even understand it one day. 😄

Great job @byorgey!

@byorgey byorgey force-pushed the refactor/strict-store branch 3 times, most recently from 7502e70 to ca3dcf9 Compare June 19, 2024 19:17
Base automatically changed from refactor/suspend to main June 19, 2024 20:00
@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Jun 19, 2024
@mergify mergify bot merged commit eb156a6 into main Jun 19, 2024
11 checks passed
@mergify mergify bot deleted the refactor/strict-store branch June 19, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reevaluate use of Store/references for recursive variables
2 participants