Closed arv closed 6 years ago
I'm really concerned about the ballooning of API complexity. My experience working on Attic was that the best way to work with structs was by way of marshaling. But now we are adding this whole other way to edit them which is "more efficient" but lots more code. People will have to decide which way they want to do it.
It doesn't feel right to me that this mechanism is completely ignorant of marshaling, which is otherwise the easiest way to work with structs in Go.
The motivation is in the bug.
I agree that we might want to get rid of the go-routine here though and keep the direct mutation methods on Map/Set/List/Struct for the one off cases.
@rafael-atticlabs ^^^
@aboodman What would it look like for this mechanism to be aware of marshalling?
I don't have an idea right now, but I feel like this is an instance of "wait for good design". That's why I was advocating for us gaining experience with the editor interface before worrying about structs.
I don't feel like dying on this hill. If @aboodman feels strongly, let's just leave this patch outstanding and demote the bug to P1. It doesn't affect format. Presumably, if someone hits memory problems trying to logically update a "column" of some tabular data, we'll hear about it and can revisit.
I'll extract the logic for mutating a struct since it is a lot cleaner than the old code.
This is similar to MapEditor
Unlike a Map all the struct data is available in memory so the building is slightly simpler.
Fixes #3602