Replies: 1 comment 1 reply
-
In an object oriented environment, I'd use a builder pattern to construct a copy of the document object with accessor methods and the visitor pattern to serialize such to KDL. There are too many things that go wrong if the object produced from your I/O call is anything other than a copy of the document state at the time of retrieval and those specific patterns (hopefully) deter other behaviors that would be more expensive in terms of shuffling bytes I'd explain how I hope to accomplish this in Lua, but that's not a thing you want to do in most other languages |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks,
When implementing kdl4j I chose to make all the model objects representing the KDL document immutable. This is definitely best practice in Java, but makes it difficult to make changes to a document. In addition, I found that accessing data in the document was somewhat clumsy. To make mutation and access operations easier, I chose to implement the functionality described (briefly) here.
They were implemented the way they are in order to support my go at a
jq
for KDL, kq, now defunct with the official KQL definition.I'm curious what other parser implementers have run into with handling these operations, and how you've chosen to solve them?
Beta Was this translation helpful? Give feedback.
All reactions