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

[internal] Use State.guard in ModuleImpl #4641

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

seldridge
Copy link
Member

Change code for building a Module from using one-off state save/restore code to use new, common code for this. This uses Builder.State methods which were developed for the Placeholder API, but were observed by @jackkoenig to be reusable here.

@seldridge seldridge added the No Release Notes Exclude from release notes, consider using Internal instead label Jan 23, 2025
blockStack = Nil,
blockStack = Builder.blockStack,
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a little surprising to me, but the old behavior is to leave the block stack in place and let the new module see it. This seems wrong, however, this is how it works.

I'm envisioning a larger refactor of this which makes a lot of this more straightforward. I.e., a module should have a single block created inside it. It shouldn't see the parent block stack. I haven't followed through on the ramifications of this change.

Copy link
Member

Choose a reason for hiding this comment

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

Yep! It's weird for sure. Thanks for straightening this all out, I know I'd be happy to see the sort of "order" you're proposing brought to these bits. But what you have already sure helps clean things up a lot, woohoo!

I can point you to further related bits (like Placeholder -> apply methods) if you'd like re:ramifications, but also you seem to be cruising so maybe best to just keep on 👍 . Nothing that won't fall out, I don't think.

@seldridge seldridge force-pushed the dev/seldridge/use-common-state-guard-in-builder branch from e8c1330 to c8a9b09 Compare January 24, 2025 02:37
@seldridge seldridge force-pushed the dev/seldridge/placeholder-api branch from 897c742 to a018a54 Compare January 24, 2025 15:47
Base automatically changed from dev/seldridge/placeholder-api to main January 24, 2025 18:38
Change the way that `Module.apply` works to use the new `State.guard`
method that automates the process of changing the "append point" for where
commands will be added.

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge force-pushed the dev/seldridge/use-common-state-guard-in-builder branch from c8a9b09 to 95024c0 Compare January 24, 2025 18:57
@seldridge seldridge marked this pull request as ready for review January 24, 2025 20:46
@seldridge seldridge requested a review from jackkoenig February 5, 2025 19:42
Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

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

It's beautiful 😭

@seldridge seldridge merged commit 6f0c185 into main Feb 6, 2025
15 checks passed
@seldridge seldridge deleted the dev/seldridge/use-common-state-guard-in-builder branch February 6, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Release Notes Exclude from release notes, consider using Internal instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants