metafacture / metafacture-fix

Work in progress towards an implementation of the Fix language for Metafacture
Apache License 2.0
6 stars 2 forks source link

Change `set_field()` behaviour to not create intermediate structures. #309

Open blackwinter opened 1 year ago

blackwinter commented 1 year ago

add_field() and set_field() are going to be equivalent with #308, but according to Catmandu's documentation set_field() "will not create the intermediate structures if they are missing".

Functional review: @TobiasNx Code review: @blackwinter / @fsteeg

TobiasNx commented 1 month ago

The aspect of the intermediate structure seems to be true for all fixes of the set_-family so not just for set_field but also for set_array and set_hash. I think that the adjustment for all these fixes makes sense since we want to adjust to the behaviour of Catmandu BUT on the side of lobid and oersi we rely on a fixes that create empty hashes and empty arrays WITH the intermediate structure. So If we move on with this, we should also introduce two new fix functions add_array and add_hash as counterpart to set_hash and set_array.

PS: The new functions add_hash and add_array could reuse the current implementation of set_array and set_hash while the version without creating intermediate structure would replace the the current one.

TobiasNx commented 1 week ago

add_array and add_hash are introduced now and the set functions are only aliases now. We should advise anybody to use the add functions instead of the set ones until the new behaviour is introduced.

Also wenn the behaviour change is implemented we should rename all set tests to add ones as well as add new set functions.