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

RFC: remove virtual structs #341

Merged
merged 1 commit into from
Oct 7, 2014
Merged

Conversation

aturon
Copy link
Member

@aturon aturon commented Sep 30, 2014

Summary

Removes the "virtual struct" (aka struct inheritance) feature, which is currently feature gated.

Motivation

Virtual structs were added experimentally prior to the RFC process as a way of inheriting fields from one struct when defining a new struct.

The feature was introduced and remains behind a feature gate.

The motivations for removing this feature altogether are:

  1. The feature is likely to be replaced by a more general mechanism, as part of the need to address hierarchies such as the DOM, ASTs, and so on. See this post for some recent discussion.
  2. The implementation is somewhat buggy and incomplete, and the feature is not well-documented.
  3. Although it's behind a feature gate, keeping the feature around is still a maintenance burden.

Detailed design

Remove the implementation and feature gate for virtual structs.

Retain the virtual keyword as reserved for possible future use.

Drawbacks

The language will no longer offer any built-in mechanism for avoiding repetition of struct fields. Macros offer a reasonable workaround until a more general mechanism is added.

Unresolved questions

None known.

@sfackler
Copy link
Member

As one data point, there are no uses of virtual struct anywhere on Github except for the tests within rust-lang/rust itself: https://github.com/search?l=rust&q=%22virtual+struct%22&type=Code&utf8=%E2%9C%93

@nrc
Copy link
Member

nrc commented Sep 30, 2014

+1. We should keep virtual as a reserved keyword though (I think this is the only use of virtual at the moment).

@sinistersnare
Copy link

isn't struct inheritance hidden behind an feature gate? If so, why does it require a RFC to be removed? thats the point of feature gates. they may be removed at any time....

@aturon
Copy link
Member Author

aturon commented Sep 30, 2014

@sinistersnare A few months ago we made a change in policy to require RFCs when removing any language features, even if feature-gated.

See this policy.

In general, we want to go through the formal feedback and decision process to change the direction on major features, whether adding or removing them.

@reem
Copy link

reem commented Oct 1, 2014

+1. This seems like a generally unused feature that will probably be made unneeded by one of the many inheritance proposals.

@brson brson merged commit fa68ec1 into rust-lang:master Oct 7, 2014
@brson
Copy link
Contributor

brson commented Oct 7, 2014

Merged as RFC 71. Discussion. Tracking.

@Centril Centril added A-data-types RFCs about data-types A-typesystem Type system related proposals & ideas A-product-types Product type related proposals A-stability Proposals relating to policy and changes about stability of features. labels Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-data-types RFCs about data-types A-product-types Product type related proposals A-stability Proposals relating to policy and changes about stability of features. A-typesystem Type system related proposals & ideas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants