Skip to content

when copying source object also copy prototype - #7

Draft
fuzetsu wants to merge 1 commit into
masterfrom
copy-proto
Draft

when copying source object also copy prototype#7
fuzetsu wants to merge 1 commit into
masterfrom
copy-proto

Conversation

@fuzetsu

@fuzetsu fuzetsu commented Oct 3, 2019

Copy link
Copy Markdown
Owner

fixes #6

@fuzetsu

fuzetsu commented Oct 18, 2019

Copy link
Copy Markdown
Owner Author

Should we use new source.constructor() instead?
Current implementation will not execute constructor when copying, meaning we could miss side effects in the constructor or if the returned object is overridden.
What is more correct?

EDIT:

If the returned object is overridden then the prototype would most likely be lost or different (but not necessarily) so that might not be an important factor.

Side effects aren't particularly desirable in this context I feel, so also maybe not a factor.

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.

consider copying prototype when merging

1 participant