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

src: explicitly disallow assign and copy #590

Closed
wants to merge 1 commit into from

Conversation

legendecas
Copy link
Member

Use macros to explicitly disallow assign and copy.

  • npm test passed.

@NickNaso
Copy link
Member

NickNaso commented Nov 7, 2019

Hi @legendecas,
the code it's ok and works, but is it really necessary disallow the copy constructor using a macro?
In this way se avoid to manually disallow the copy constructor in 9 classes, but we will lose in code readability.
What do you think?

@legendecas
Copy link
Member Author

@NickNaso I found that this is what's done in Node.js core, v8, and NAN, lots of C++ projects.

It can not be denied that with macros we could not get first sight of what's done after the macro expansion. Yet since disallowing assign/copy/move operations are so commonly used, and I cannot assume it would be easy to write such things every time without missing something. So a macro with a straightforward name describing what it would do will be helpful. And I'd assume it would not be confusing very much on this use case.

@gabrielschulhof
Copy link
Contributor

@legendecas could you please rebase?

@legendecas
Copy link
Member Author

@gabrielschulhof rebased :D

gabrielschulhof pushed a commit that referenced this pull request Dec 24, 2019
PR-URL: #590
Reviewed-By: Gabriel Schulhof <[email protected]>
@gabrielschulhof
Copy link
Contributor

Landed in 79deefb.

@legendecas legendecas deleted the disallow branch January 1, 2020 13:31
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
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.

3 participants