liufengyun / hashdiff

Hashdiff is a ruby library to to compute the smallest difference between two hashes
MIT License
560 stars 63 forks source link

Handle multi dimentional arrays in path decoder #83

Open dmitrytrager opened 2 years ago

dmitrytrager commented 2 years ago

This fixes issue related to handling multi dimensional arrays in path

liufengyun commented 2 years ago

Thanks @dmitrytrager . What's your use case? Multi-dimentional arrays will not work nicely with this library due to its limitations.

dmitrytrager commented 2 years ago

My case is exactly like mentioned: nested arrays within hash. With this fix we can handle changes within structure like this properly.

liufengyun commented 2 years ago

I see. But generally, the diff generated by multi-dimensional arrays will be very bad to be useful.

dmitrytrager commented 2 years ago

Could you please give more details about reasons here? B/c right now it looks like if my structure includes these, then diff should be very useful.

liufengyun commented 2 years ago

Could you please give more details about reasons here?

The reason is that telling whether two arrays are similar may not make much sense in most scenarios.

dmitrytrager commented 2 years ago

Sorry, I don't get how does less frequent scenario mean "very bad to be useful"

liufengyun commented 2 years ago

Sorry, I don't get how does less frequent scenario mean "very bad to be useful"

I don't have objective data to tell whether it's generally useful or not. I just want to avoid disappointing the users with a feature that is not well-considered.

Anyway, thank you for making the PR and making the use case known. Let's wait for more users to share their feedback on this feature.

dmitrytrager commented 2 years ago

Ok, having feedback would be great