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

moxie::Key is and isn't a smart pointer #197

Open
anp opened this issue Sep 27, 2020 · 1 comment
Open

moxie::Key is and isn't a smart pointer #197

anp opened this issue Sep 27, 2020 · 1 comment
Labels
core Related to the core `moxie` crate

Comments

@anp
Copy link
Owner

anp commented Sep 27, 2020

Two API guidelines are in conflict for Key:

  • Smart pointers do not add inherent methods (C-SMART-PTR)
  • Only smart pointers implement Deref and DerefMut (C-DEREF)

Key implements Deref (but not DerefMut), and it adds inherent methods. Its deref impl is useful for sharing the "current state" with app logic as it is.

@anp anp added this to the moxie 1.0 milestone Sep 27, 2020
@anp
Copy link
Owner Author

anp commented Sep 27, 2020

Key shouldn't implement Deref -- it has footguns! Notably it's pretty easy to rely on the deref behavior immediately after having updated the key, only to find it hasn't actually changed.

zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Dec 14, 2020
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Dec 29, 2020
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Jan 3, 2021
zetanumbers pushed a commit to zetanumbers/moxie that referenced this issue Jan 5, 2021
@anp anp added the core Related to the core `moxie` crate label Feb 2, 2021
@anp anp modified the milestones: moxie 1.0, moxie-dom 0.3.0 May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the core `moxie` crate
Projects
None yet
Development

No branches or pull requests

1 participant