Skip to content

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented May 14, 2015

  • copy option
  • accessor option
  • Makefile
  • README
  • validation dependencies
  • dev dependencies
  • remove preamble
  • update license info
  • tests for code pathways
  • dotfiles

Resolves compute-io/todo#40

NOTE: breaking change. add no longer mutates by default. This behavior must be explicitly set using the copy option. While memory management is important, three factors contribute to turning off mutation by default:

  1. principle of least surprise: mutation is a source of bugs, especially when multiple operations may operate on the same data store. Reasoning about mutable objects as they travel through a program with black boxes (functions mutating state) is more complex.
  2. consideration that, for object arrays, mutation has a side-effect that object elements are eliminated and replaced with numeric results. For more complex object arrays, this is unlikely to be desired. Setting {'copy':true} for each invocation is probably more than should be asked.
  3. readability. If mutation is desired, having the invocation signature add( x, y, {'copy': false}) means that the code is explicit in describing the behavior. If I understand that the copy option pertains to mutation, then I derive meaning from the signature.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 93d3355 on develop into 3ede407 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 93d3355 on develop into 3ede407 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a5d30b3 on develop into 3ede407 on master.

@Planeshifter
Copy link
Contributor

LGTM. I merge the pull request and then you can publish the update to npm.

@Planeshifter Planeshifter reopened this May 15, 2015
Planeshifter added a commit that referenced this pull request May 15, 2015
@Planeshifter Planeshifter merged commit 6d0eb37 into master May 15, 2015
@kgryte kgryte deleted the develop branch May 15, 2015 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update add
3 participants