Extract XML::Document from XML::Node#15920
Merged
straight-shoota merged 2 commits intocrystal-lang:masterfrom Jul 2, 2025
Merged
Extract XML::Document from XML::Node#15920straight-shoota merged 2 commits intocrystal-lang:masterfrom
XML::Document from XML::Node#15920straight-shoota merged 2 commits intocrystal-lang:masterfrom
Conversation
Introduces the XML::Document type to wrap a Pointer(LibXML::Doc), while XLM::Node is meant to wrap the subtree Pointer(LibXML::Node). The XML::Document inherits from XML::Node and acts exactly like a XML::Node, so it should hopefully be a transparent change. The main advantage is that we now register a single finalizer instead of one for every node (only the document needed a finalizer). Sadly, it doesn't allow to have a dual strong reference from a document to its nodes, and from the nodes to their document. Boehm GC still complains about cyclic finalization, despite only the document having a finalizer.
c5791a6 to
210a1c8
Compare
straight-shoota
approved these changes
Jun 27, 2025
XML::Document from XML::Node
Sija
reviewed
Jun 27, 2025
| # reference of its XML::Node and any instantiated descendant must be updated | ||
| # to pointer to the new document Node. | ||
| @document : Node | ||
| @document : Document |
Contributor
There was a problem hiding this comment.
Suggestion: could use a getter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces the
XML::Documenttype to wrap aLibXML::Doc*, whileXML::Nodeis meant to wrap the subtreeLibXML::Node*.The
XML::Documentinherits fromXML::Nodeand acts exactly like aXML::Node, so it should hopefully be a transparent change (no breaking changes).The main advantage is that we now register a single finalizer instead of one for every node (only the document needed a finalizer).
Sadly, it doesn't allow to have a dual strong reference from a document to its nodes, and from the nodes to their document. Boehm GC still complains about cyclic finalization, despite only the document having a finalizer.
Follow up to #15906
Related to #15915