EmbarkStudios / EmbarkStudios/mirror-mirror

What are the semantics of `patch()`?

Open
#79 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
101
Forks
7
PR merge metrics
No merged PRs in 30d

Description

It seems that `patch` won't _augment_ existing objects: e.g. if I patch a list with a larger list, the patchee won't get any push for the missing entries. Ditto for structs, and there it makes sense imo: while we could _add new fields_ to the reflected value, this wouldn't have any effect when converting back to the actual struct type. At the same time, one could use `Value` as a very generic way to manipulate values in general, and then it might make sense to add new fields etc (e.g. a serialization framework could use that to run "migrations").

I'm not advocating for one way or another, I'm just curious about the _why_ behind this choice, and I think it'd make sense documenting that choice in a doc-comment on `patch()` :)

Contributor guide

Open the contributing guide

Research direction

Locate the implementation and existing documentation for `patch()` first. Check how patching behaves for lists and structs, then document those semantics and the rationale in the `patch()` doc-comment. Done means the comment explains whether missing entries or fields are augmented and why.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.