-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Opt-in builtin traits #19
Conversation
ping @brson @alexcrichton @pcwalton, to best of my memory, this is what we discussed in the work week. |
@cmr I know you had some thoughts to share about this. |
So after thinking about it and re-reading the RFC, I think it's good, but the second downside concerns me a lot. OIBIT also means that in one's own programs extra annotations are needed to use their own types. My first thought was to have a My other thought was to allow implementations of built-in traits, but not require them. But if you specify any of them, none of the others would be inferred. Additionally, anything marked stable wouldn't have builtins inferred ever. This needs no extra annotations for simple uses, but loses the (very nice) pedagogy and simplicity properties. I wouldn't mind this RFC being accepted but I still worry a lot about 3rd party libraries being sloppy and making life very hard for certain users. |
I'd prefer to do it all the way or not do it at all rather than halfway do On Monday, March 24, 2014, Corey Richardson notifications@github.com
|
This has my humble +1, I don't think this is a silver bullet, but when weighing the tradeoffs between today's system and this proposal, I believe that this proposal wins out. |
Finally got the time to read through the proposal. I was already pretty convinced of the benefits of having opt-in traits, despite the downsides this brings. The RFC is well written and the remaining open questions can be addressed with follow-up enhancements to this RFC. FWIW, this gets my +1 |
I think this RFC gives way too little attention to the issues of verbosity of declarations and libraries forgetting to implement traits, which are at least as important as consistency, API stability, pedagogy and safety, and are not really satisfactorily addressed, since after this RFC making a "simple" struct is far more verbose than right now. In general, while making Copy explicit seems a good idea, it doesn't really seem clear that there are many use cases for explicitly not having Share or Send in any type defined outside core libraries. The fact that Clone and Eq are opt-ins is merely the current situation, and while making everything explicit is a way of making things consistent, making Clone and Eq implicit as well (at least in some cases) would make things consistent as well. Perhaps we need several types of structs where one type has all implicit by default, and other types have less things or nothing implicit (maybe one for pure data aggregation, another for objects with invariants, another for objects with invariants and methods with unsafe side effects, etc.), where the "types" could either be built-in concepts or traits inheriting a bunch of kinds allowing to declare all of them at once, or perhaps names for groups of kinds to implicitly implement, but only if possible. And at any rate, the syntax should be minimal and without additional alphanumeric tokens, like |
They are satisfactorily addressed. We already need this for deriving. On Tuesday, March 25, 2014, bill-myers notifications@github.com wrote:
|
Err, we already have this issue with deriving. I really want opt-in because On Tuesday, March 25, 2014, Patrick Walton pcwalton@mimiga.net wrote:
|
(Not that the error reporting couldn't be improved without this. But I'm in On Tue, Mar 25, 2014 at 5:35 PM, Patrick Walton notifications@github.comwrote:
|
I am concerned that this will be another thing that library authors will forget to do, but I guess we can try it and see how it turns out. There is the |
This proposal has been in discussion for quite some time now, and the core team is all in favor of merging this. This is not meant to be a magical fix and solve all problems, this is a question of tradeoffs. Merged as 79992d6 |
Relevant discussion in today's meeting: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25#opt-in-traits |
On Tue, Mar 25, 2014 at 02:33:50PM -0700, bill-myers wrote:
I just saw this portion of your comment now, sorry. I initially found |
@nikomatsakis Well, we could remove #[deriving] and make You could still impl manually like now with deriving. |
On Wed, Mar 26, 2014 at 12:28:07PM -0700, bill-myers wrote:
We could. That seems like a separate RFC. I personally prefer the Niko |
In particular: * The RFC associated with rust-lang#127 should have had a link to rust-lang#19 as well (and has been assigned RFC rust-lang#19); it also was revised to match the markdown href style of other RFCs. * RFC rust-lang#34 needed its header entries filled in, * RFC rust-lang#123 had a typo in its header, and * RC rust-lang#155 was revised to match the markdown href style of other RFCs.
Update reference & deshadowing.
As originally proposed in my blog post.