Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we publish a version 2? #72

Closed
TehShrike opened this issue Aug 25, 2017 · 10 comments · Fixed by #77
Closed

Should we publish a version 2? #72

TehShrike opened this issue Aug 25, 2017 · 10 comments · Fixed by #77

Comments

@TehShrike
Copy link
Owner

TehShrike commented Aug 25, 2017

This module is pretty stable, but there are a few pieces of backwards-compatibility cruft that I would trim given the chance.

  1. The default array merging algorithm is complicated and I don't think anyone could guess what it was without reading the code
  2. By default, a new object is created for the output, but any child objects are moved right over instead of being cloned, unless you pass in clone: true

Since you can pass in custom array merge functions, I would rather default to the super-simple method of just concatenating arrays and let people do more complicated things on their own if they need to.

I think clone should default to true - I think it's what people would most likely expect, and it's the safer option.

We could even consider deprecating the clone option and eventually supporting only deep clones. This seems doable because nobody has apparently had any issue with the fact that a new object is always created for the output already.

If we always cloned, it would also free us up to make merge.all a bit more forgiving, ala #71.

So:

  • Is cleaning up this cruft worth publishing a breaking change?
  • Is there any other cruft you can think of that could be cleaned up in a breaking change?
@macdja38
Copy link
Collaborator

So long as we clearly document the change at the top of the npm page + provide an example of how users can easily switch back to the old behavior I don't see too much of a problem. obviously cloning would be a bad way of dealing with certain things because people may not expect it... for example a user using a object based module system probably does not want their modules cloned as calling methods from the cloned vs uncloned objects would have different internal state...

@TehShrike
Copy link
Owner Author

Yeah, that intuitively seems like a change that would bite some people.

I'd be more worried about it, except nobody seems to have ever been bothered by the root object always being freshly created every time, which seems like the case that would matter most. ¯\_(ツ)_/¯

@macdja38
Copy link
Collaborator

macdja38 commented Sep 4, 2017

I could see a lot more people using the library on objects that contain classes vs on classes themselves, but I definitely agree that cloning everything is probably a better way to avoid unexpected behavior in the majority of cases. Along with clear documentation on how to reverse the behavior I see no problem with it.

@z0al
Copy link

z0al commented Sep 13, 2017

+1
But, we should of course document the changes

@NoxWings
Copy link

NoxWings commented Sep 28, 2017

I think clone should default to true

Exactly this

@nrkn
Copy link

nrkn commented Oct 3, 2017

Agree strongly with all of your suggestions, they would make it much better

@TehShrike
Copy link
Owner Author

I've opened a pull request - reviews of #77 would be appreciated!

@TehShrike
Copy link
Owner Author

If there aren't any reviews, I'll merge/release next week.

@TehShrike
Copy link
Owner Author

Version 2.0.0 has been published! Open new issues for anything you notice that seems off.

@nrkn
Copy link

nrkn commented Oct 10, 2017

I'll have the opportunity to put it through its paces pretty intensively soon, merging multiple nodes with complex models from a graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants