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

Proposal: Rename interfaces to traits #2095

Open
nacaclanga opened this issue Aug 24, 2022 · 2 comments
Open

Proposal: Rename interfaces to traits #2095

nacaclanga opened this issue Aug 24, 2022 · 2 comments
Labels
leads question A question for the leads team long term Issues expected to take over 90 days to resolve.

Comments

@nacaclanga
Copy link

In C++ the term "interface" is often used as a synonym for "abstract classes". A similar definition is used in Java, where interfaces have special meaning, as the can circumwent the limitation of having only one base class. In Carbon however the current proposal describes "interfaces" to be more akin to the concept known as "traits" in Rust (the only difference being that there are also structural "traits"/"interfaces")

I therefore propose to rename "interfaces" into "traits" and replace the "interface" keyword by a new "trait" keyword. This will avoid false connotations for people from a C++ background and make the concept more easily understandable for people familiar with Rust.

@geoffromer
Copy link
Contributor

The word "trait" also has a pre-existing meaning in C++, and it's much more well-established than "interface" (for example, it's used pervasively in the standard library). So at least in terms of consistency with C++ this seems like it would be a regression.

I also don't think the existing Java/C++ meaning of "interface" will cause that much confusion, because even though Carbon interfaces have somewhat different mechanics, they represent very similar concepts, and play very similar roles in the language. In particular, Carbon interfaces seem much more similar to Java/C++ interfaces than to C++ traits.

@github-actions
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the inactive label. The long term label can also be added for issues which are expected to take time.
This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Issues and PRs which have been inactive for at least 90 days. label Nov 26, 2022
@jonmeow jonmeow added long term Issues expected to take over 90 days to resolve. leads question A question for the leads team and removed inactive Issues and PRs which have been inactive for at least 90 days. labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leads question A question for the leads team long term Issues expected to take over 90 days to resolve.
Projects
None yet
Development

No branches or pull requests

3 participants