Open
Conversation
Fixes KSP-KOS#2894 There are going to be two proposals for how to fix KSP-KOS#2894. (Read the comments for the issue). This is one of them. In this proposal, We stop borrowing the Dump infrastructure for creating ToString()s. The Dump infrastructure was designed for when you want to serialize, meaing every single field must be visited and written with nothing 'missing', so values can be saved and restored. I found that layering on top of that system while still preserving the notion of ToString() being meant for human consumption was kind of hard to wrap my head around so I went with this idea. This PR is being made before this is fully tested, so it can be shown to other people who are proposing alternate solutions. I also want to show what this output ends up looking like when you try it. Note the code still has some "eraseme" things in it at this point, which is how I remind myself that an idea wasn't done yet. (I have a check I do before a final PR, usually, where I 'grep' all my code for the string "eraseme" to highlight places I stuck something in temporarily during testing. Here I'm using that to remind myself of stuff that isn't done yet in this PR. While I think this produces good output, I am willing to be convinced other approaches might work too, so I'm open to trying to preserve using Dumper for indented ToString()s if it can be done.
Member
Author
|
Here is an example program and the output it makes with this PR. Example program: |
Member
Author
|
Hah I just realized I used the terminology "top ->" when showing a Queue and "front ->" when showing a Stack. Those terms should be swapped. |
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.

Fixes #2894
There are going to be two proposals for how to fix #2894. (Read the comments for the issue).
This is one of them.
In this proposal, We stop borrowing the Dump infrastructure for
creating ToString()s. The Dump infrastructure was designed for
when you want to serialize, meaing every single field must be
visited and written with nothing 'missing', so values can be
saved and restored. I found that layering on top of that
system while still preserving the notion of ToString() being meant
for human consumption was kind of hard to wrap my head around
so I went with this idea.
This PR is being made before this is fully tested, so it can be
shown to other people who are proposing alternate solutions. I
also want to show what this output ends up looking like when you
try it. Note the code still has some "eraseme" things in it
at this point, which is how I remind myself that an idea wasn't
done yet. (I have a check I do before a final PR, usually, where
I 'grep' all my code for the string "eraseme" to highlight places
I stuck something in temporarily during testing. Here I'm using
that to remind myself of stuff that isn't done yet in this PR.)
While I think this produces good output, I am willing to be convinced
other approaches might work too, so I'm open to trying to preserve
using Dumper for indented ToString()s if it can be done.