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

Function naming decoration to alert for a deepcopy in the body #232

Closed
vitornesello opened this issue Jan 3, 2020 · 1 comment
Closed
Labels
discussion Further information is requested

Comments

@vitornesello
Copy link
Collaborator

It might be interesting to extend the ! concept for when a function uses deepcopy. Like this:

  • function f(foo) : No side-effects
  • function f!(foo) : Side effects
  • function f!!(foo) : Has deepcopy and likely side-effects

deepcopy can be quite dangerous and sometimes we fall in the trap of calling a function that deepcopies an argument and then use the deepcopied argument hoping the modifications would be persistent on the structures modified by the deepcopying function.

What do you think?

@vitornesello vitornesello added the discussion Further information is requested label Jan 3, 2020
@guimarqu
Copy link
Contributor

I don't think it's necessary if the documentation warns the user that the function performs a deepcopy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants