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

Use _.create in extend #3553

Merged
merged 1 commit into from
Sep 24, 2015
Merged

Use _.create in extend #3553

merged 1 commit into from
Sep 24, 2015

Conversation

megawac
Copy link
Collaborator

@megawac megawac commented Apr 2, 2015

As mentioned here jashkenas/underscore#2074

@megawac megawac added the change label Apr 2, 2015
@jashkenas
Copy link
Owner

Is it worth breaking backwards compatibility so soon for this? Not worth waiting until _.create has a chance to penetrate for a while?

@megawac
Copy link
Collaborator Author

megawac commented Apr 2, 2015

Just raising an issue, can sit on it. It shouldn't break backwards compat unless people are relying on old versions of underscore

@jridgewell
Copy link
Collaborator

The extend vs assign (in create) is a midly breaking change. I think the common case, though, is simple objects.

@akre54 akre54 mentioned this pull request Apr 16, 2015
3 tasks
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// `parent`'s constructor function and add the prototype properties.
child.prototype = _.create(parent.prototype, protoProps);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also need to set child.prototype.constructor = child.

@jridgewell jridgewell added this to the v2 milestone Jun 10, 2015
@jridgewell
Copy link
Collaborator

Ping @megawac, want to rebase and add in the child.prototype.constructor = child change?

@megawac
Copy link
Collaborator Author

megawac commented Sep 18, 2015

Right, done

@jridgewell
Copy link
Collaborator

LGTM.

@akre54
Copy link
Collaborator

akre54 commented Sep 24, 2015

April's long enough. Let's do this.

akre54 added a commit that referenced this pull request Sep 24, 2015
@akre54 akre54 merged commit bd0fbde into jashkenas:master Sep 24, 2015
@jridgewell jridgewell mentioned this pull request Oct 27, 2015
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants