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

Why the delete operation needs an object? #33

Open
nnseva opened this issue Jan 15, 2020 · 1 comment
Open

Why the delete operation needs an object? #33

nnseva opened this issue Jan 15, 2020 · 1 comment

Comments

@nnseva
Copy link

nnseva commented Jan 15, 2020

Let's imagine that the data contains a very big branch, f.e.
{key: {a:1,b:2,...,z:27}, other:...}

We are going to delete the whole branch "key" for some reason. As I understand, the operation then should look like {p:["key"], od:{a:1,b:2,...,z:27}}.

But for the delete operation, the logically required information is the only key of the deleted item. The deleted object content is the extra info which is not necessary for the operation.

It was probably useful to exclude repeating object content for the delete operation and replace it by something neutral, like logical true.

{p:["key"], od:true}

It looks much more compact and logical.

@josephg
Copy link
Member

josephg commented Jan 16, 2020

The reason it works this way is so operations can be inverted, which makes many features like undo easy to implement. I’m not sure about the state of the codebase now, but for a time the code would function just fine the way you suggest too. (It doesn’t need to know what content was deleted to support compose/transform/apply.)

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

No branches or pull requests

2 participants