Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed replace field #84

Closed
wants to merge 1 commit into from
Closed

Conversation

stokhos
Copy link
Contributor

@stokhos stokhos commented Jan 20, 2021

fixes #78

@stokhos stokhos marked this pull request as draft January 20, 2021 08:13
@kneasle
Copy link
Owner

kneasle commented Jan 20, 2021

Ah so this is related to my comment in #78. This was my initial idea for fixing the issues, but the ideal scenario would be to set the code up so that replace is simply deletion followed immediately by insertion. This would remove any possibility for #78 to occur.

@stokhos
Copy link
Contributor Author

stokhos commented Jan 21, 2021

Ah so this is related to my comment in #78. This was my initial idea for fixing the issues, but the ideal scenario would be to set the code up so that replace is simply deletion followed immediately by insertion. This would remove any possibility for #78 to occur.

Yes, this actually harder than I thought.

@kneasle
Copy link
Owner

kneasle commented Jan 21, 2021

Yes, this actually harder than I thought.

It's strange that sometimes problems look easy when you start solving them, then you start writing code and it suddenly hits you that the problem is actually really hard 😆. I spent a good while chatting with @shtanton over what the best way of fixing this was - because it's not impossible to patch up the existing code with even more complexity, but we both agreed that what would be ideal is if the replace code could just be a series of delete_child/insert_children (which would fix this problem, because the insertion would implicitly create a new field). But that's currently insanely hard to do (because Json::Field stores its children in a way that you can't delete from), so I'm currently refactoring the ast module to make this possible.

@stokhos stokhos closed this Jan 23, 2021
@stokhos stokhos deleted the replace_field branch January 25, 2021 21:37
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.

Replacing fields results in an invalid tree
2 participants