Skip to content

Make visitor immutable-friendly#11

Open
corydolphin wants to merge 1 commit into
update-minimum-python-version-tofrom
make-visitor-immutable-friendly
Open

Make visitor immutable-friendly#11
corydolphin wants to merge 1 commit into
update-minimum-python-version-tofrom
make-visitor-immutable-friendly

Conversation

@corydolphin
Copy link
Copy Markdown
Owner

Modifies the AST visitor to use copy-on-write semantics when applying
edits. Instead of mutating nodes in place, the visitor now creates new
node instances with the edited values. This prepares for frozen AST
nodes while maintaining backwards compatibility.

The visitor accumulates edits and applies them by constructing new
nodes, enabling the transition to immutable data structures.

Thank you for contributing to GraphQL-core!

If your pull-request is non-trivial, adds a feature or contains a non-breaking change, then please, first open an issue to discuss the proposed changes and add a link to that issue.

GraphQL-core tries very hard to stay within the scope of being just a Python port of GraphQL.js.

Any additional feature or incompatible change will be only accepted in rare cases and requires a compelling reason, because they aggravate maintenance and synchronization with the developments in the upstream project. So please discuss such changes upfront in an issue before sending a PR. Maybe there are other ways to solve the problem.

If possible, also add unit tests, or provide runnable example code as part of the accompanying issue, from which unit tests can be derived.

Modifies the AST visitor to use copy-on-write semantics when applying
edits. Instead of mutating nodes in place, the visitor now creates new
node instances with the edited values. This prepares for frozen AST
nodes while maintaining backwards compatibility.

The visitor accumulates edits and applies them by constructing new
nodes, enabling the transition to immutable data structures.
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.

1 participant