NickPolyder / NP.ObjectComparison

This repository serves as a library that will make Object Patching and diff easier.
MIT License
2 stars 0 forks source link

Possible issue using Reset() on ObjectComparison #2

Closed codepend closed 2 years ago

codepend commented 2 years ago

When calling myObj.Reset() it appears that it sets the Original Value to the Current Value or something like that. It seems like reset would set the Current = Original instead of the other way around. Here is a screenshot of the code tip. Is this intended behavior?

image

NickPolyder commented 2 years ago

Hmmm usually when we are reseting something to its original state this is what we do isnt it the case ?

codepend commented 2 years ago

Wouldn't we set the Current to the Original to Reset? Like Current is the (potentially) modified version and we want it to revert to the Original Version?

Seems like Reset sets the Original to the Current value.

public void Reset()
{
    Original = CloneValue();
    _currentAnalysis = null;
}

Maybe it is just a naming thing?

NickPolyder commented 2 years ago

Ah yeah might have done an oopsie in the comment ? Depends how we interpret it i guess. It could be a Reset in a manner of I revert my changes or it can be a Reset in a manner of I reset the tracking progress and start from my current work again.

Which one do you think we should go with ?

codepend commented 2 years ago

Well I noticed there is a RevertTo as well, and this seems like it is for some future functionality with "history"...

Anyhow, I could see a use for setting the Original to the CurrentValue, but I guess the naming should be clear. Personally I think Reset is equivalent to resetting everything back to the Original values. Maybe a separate method for ResetToCurrent() or OverwriteOriginal() for something like overwriting the original with the current values?

NickPolyder commented 2 years ago

I could use Reset(bool toCurrent = false) what do you think ? and yes i plan to add history functionality in the future. :D

codepend commented 2 years ago

Yeah I guess that is good, simple.

NickPolyder commented 2 years ago

@codepend You should find them changes in version 0.9.8.1

Closing this one.