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

Updated extensibility to discuss non_exhaustive #135

Merged
merged 26 commits into from
Sep 1, 2021

Conversation

rcoh
Copy link
Contributor

@rcoh rcoh commented Jan 2, 2021

A first cut at discussing how #[non_exhaustive] should be used.

Fixes #132

A first cut at discussing how `#[non_exhaustive]` should be used
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
@simonsan simonsan added this to In progress in Content Jan 3, 2021
rcoh and others added 2 commits January 3, 2021 13:18
Co-authored-by: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com>
Updated to match the Rust Doc
@rcoh rcoh requested a review from MarcoIeni January 3, 2021 19:50
Copy link
Collaborator

@simonsan simonsan left a comment

Choose a reason for hiding this comment

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

I miss the discussion when to use privacy and when to use #[non_exhaustive]. There are different use cases aren't they?

We should compare them in here and give a small direction for people to let them decide when to use what.

I like that read as well, to understand the background, a # See also section might be good to add.

# See also
  - https://github.com/rust-lang/rfcs/blob/master/text/2008-non-exhaustive.md

And then the # Advantages, # Disadvantages section could state general arguments for/against(?) field extensibility. While the # Discussion point can discuss when to use which of them both.

Content automation moved this from In progress to Review in progress Jan 4, 2021
@pickfire
Copy link
Contributor

pickfire commented Jan 4, 2021

I only see that the advantages being mentioned but not the disadvantages. Most of the time I see this as unnecessary because it prevents the compiler from doing its job to check that the developer handle all the fields. This could be one example, in most cases having a breaking change by adding a new field to an enum is better than using #[non_exhaustive] as the user may not even notice that there is a new field if they want to handle all fields.

Maybe we should have a good example on both decisions and when to apply (or not to) them.

Flesh out the discussion
@rcoh
Copy link
Contributor Author

rcoh commented Jan 6, 2021

I've fleshed out the discussion some more although I think there's still a bit more to do

idioms/priv-extend.md Outdated Show resolved Hide resolved
rcoh and others added 2 commits January 18, 2021 23:20
Co-authored-by: Ivan Tham <pickfire@riseup.net>
@simonsan simonsan moved this from Review in progress to In progress in Content Jan 21, 2021
@simonsan simonsan added the A-idiom Area: Idioms label Jan 23, 2021
@simonsan
Copy link
Collaborator

@pickfire @MarcoIeni Want to give it a read as well?

@rcoh What did you want to add to it still? Or is it fine from your side now?

@simonsan simonsan dismissed their stale review March 29, 2021 18:30

Was updated in the meantime

Content automation moved this from In progress to Review in progress Mar 29, 2021
@rcoh
Copy link
Contributor Author

rcoh commented Mar 29, 2021

good from my side

idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
@simonsan
Copy link
Collaborator

simonsan commented Apr 1, 2021

@rcoh I think only the last review comment is left and fixing the doc test and then we're good to go! :)

@HKalbasi
Copy link

Seems @rcoh lost interest on this. Can a team member finish it? It's a pity that the old article is online while this is almost ready.

@simonsan
Copy link
Collaborator

Seems @rcoh lost interest on this. Can a team member finish it? It's a pity that the old article is online while this is almost ready.

Should be fine now, @MarcoIeni @pickfire might want to read over it once more so we can merge it.

idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
idioms/priv-extend.md Outdated Show resolved Hide resolved
Content automation moved this from Review in progress to Reviewer approved Sep 1, 2021
@simonsan simonsan merged commit 567a1f1 into rust-unofficial:main Sep 1, 2021
Content automation moved this from Reviewer approved to Done Sep 1, 2021
@simonsan
Copy link
Collaborator

simonsan commented Sep 1, 2021

Thank you everyone. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-idiom Area: Idioms C-enhancement Category: Enhancements to content
Projects
Development

Successfully merging this pull request may close these issues.

Should #[non_exhaustive] be advised over private members for extensibility?
5 participants