Skip to content

skip(Clone) #105

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

skip(Clone) #105

wants to merge 2 commits into from

Conversation

ModProg
Copy link
Owner

@ModProg ModProg commented Jan 30, 2025

fixes #104

Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Just hypothetically, what will we do when we get to a breaking change? Will we ever want derive_where(skip) to make Clone just call default() instead?

I'm thinking that letting Clone call default() under the term skip is not ideal and would clash with the general usage of derive_where(skip). I propose instead a new attribute: derive_where(clone_default) or derive_where(clone(default)). WDYT?

Will make a review of the code properly after figuring this out, because it would change the code entirely probably.

@ModProg
Copy link
Owner Author

ModProg commented Apr 10, 2025

I think I'm getting to a point there I'm questioning the global skip as a feature. I think it makes sense to have skips for EqHash etc. but just skipping for all traits that currently support the feature seems strange to me now

@daxpedda
Copy link
Collaborator

I think I'm getting to a point there I'm questioning the global skip as a feature. I think it makes sense to have skips for EqHash etc. but just skipping for all traits that currently support the feature seems strange to me now

Didn't cross my mind at all, but seems quite reasonable to me. In hindsight, a global skip almost looks like a footgun.

But unrelated, right? Or did you mean to keep skip(Clone) instead of a dedicated attribute considering you want to remove the global skip in the future?

@ModProg
Copy link
Owner Author

ModProg commented Apr 10, 2025

I feel like skip(Clone) is in line with other things that don't explicitly specify that Default will be used, when "removing" a value e.g. https://doc.rust-lang.org/std/mem/fn.take.html

@daxpedda
Copy link
Collaborator

Hm, skip to me implies that nothing is done, like with all the other traits skip supports right now. Clone definitely seems like a departure to me in this regard. While default() can imply something like "empty", as with std::mem::take(), it seems still different to me then "nothing" as "not used" or "skipped".

I will go ahead and review nevertheless, not a big issue really.

@ModProg
Copy link
Owner Author

ModProg commented Apr 10, 2025

I see your point, but thought of skip more as not doing the specific thing in this case cloning, but still doing what is required to allow the skipping, in this case defaulting.

Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Looks great!
Just needs an update of the README.

Co-authored-by: daxpedda <daxpedda@gmail.com>
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.

Feature: Support skip on Clone derives
2 participants