On 01.02.2017 21:00, Andrey Somov wrote:
> /"*Comments*/*are a presentation detail
> <
http://yaml.org/spec/1.1/current.html#presentation%20detail/> and must
> not have any effect on the serialization tree
> <
http://yaml.org/spec/1.1/current.html#serialization/> or representation
> graph <
http://yaml.org/spec/1.1/current.html#representation/>.*"
> Well, the tree/graph is nothing but the Node tree. If the Node is
> completely unaware of the comments, where the comments should live in ?
>
> If you have an idea how to solve the problem - your contribution is
> welcome !!!
Idea: store presentation details in a separate data structure.
Essentially a parse tree minus the actual data.
Merging the data back in while serializing would require a new API call,
and likely a new implementation.
Extra challenge: avoid code duplication without affecting performance
for the non-representation-preserving flow. My knee-jerk approach would
be to try subclassing, with the understanding that that road might be
bumpy with (maybe) the occasional chasm to bridge.
No contribution from me.
I see a valid and worthwhile use case (updating manually-written config
files through a program), but I have none of them on my table right now
and too many other for-fun projects.
But maybe the outline above will help somebody get into the right mood
for doing it. If you, I'll be happy, if not, I won't be disappointed :-)