Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRFC: Change DST syntax to `T: Sized?` #490
Conversation
This comment has been minimized.
This comment has been minimized.
arcto
commented
Nov 29, 2014
|
+1. Looks coherent. So with this syntax one could also use these specifications? What about |
This comment has been minimized.
This comment has been minimized.
|
@arcto You can already type When we get negative bounds you should be able to type |
This comment has been minimized.
This comment has been minimized.
|
I'm weakly in favour of this - I originally liked the I would be wary of having Another worry is that this is churn for not very much benefit. It should be easy to implement, but there will be a lot of fallout. |
This comment has been minimized.
This comment has been minimized.
|
Nice!
|
This comment has been minimized.
This comment has been minimized.
I like that idea in general and I did consider it when making the RFC, but it simply looks a bit weird: in English, ‘?’s come after things, not before. (The same argument could be applied to If enough people like the
I don’t think DST is used too much yet outside the standard library, so I don’t think this will turn out to be a hugely problematic change. We could allow the old syntax with a warning for some time, anyway. |
nrc
self-assigned this
Nov 30, 2014
This comment has been minimized.
This comment has been minimized.
|
(assigning myself to shepherd this - we should discuss it pretty soon, I don't think we need to wait for a triage meeting to assign a shepherd) |
This comment has been minimized.
This comment has been minimized.
jfager
commented
Nov 30, 2014
|
Just to throw it out there, |
This comment has been minimized.
This comment has been minimized.
pkondzior
commented
Nov 30, 2014
|
Is there any reason why we would not name negative bounds with exclamation mark on the end ? ie |
This comment has been minimized.
This comment has been minimized.
The imaginary (for now) |
This comment has been minimized.
This comment has been minimized.
gifnksm
commented
Nov 30, 2014
|
How about |
This comment has been minimized.
This comment has been minimized.
arcto
commented
Nov 30, 2014
|
@gifnksm: Using a minus sign to negate an implicit bound goes well with using a plus sign to add a bound, but how would one specify the case of "possibly unsized"? |
This comment has been minimized.
This comment has been minimized.
gifnksm
commented
Nov 30, 2014
|
@arcto I wrote "
|
This comment has been minimized.
This comment has been minimized.
|
I don't see a problem with I do like |
This comment has been minimized.
This comment has been minimized.
|
I’m not a huge fan of Regarding |
This comment has been minimized.
This comment has been minimized.
|
I like |
This comment has been minimized.
This comment has been minimized.
reem
commented
Dec 2, 2014
|
Moving to |
This comment has been minimized.
This comment has been minimized.
|
All schemes generalise, the current scheme would be |
This comment has been minimized.
This comment has been minimized.
UtherII
commented
Dec 2, 2014
|
I support the |
This comment has been minimized.
This comment has been minimized.
tikue
commented
Dec 3, 2014
|
The gain in consistency across the board wins me over. I prefer changing to |
This comment has been minimized.
This comment has been minimized.
|
Can't we just get rid of this freaky If I want to define a trait for types that must be
If I want to define a trait for types that may or may not be
The obvious downside to this is that it will require a lot of extra typing to add Even without trait inference, the upside to this is that it would keep the trait system sane and consistent. Is there something wrong with this plan that I'm not seeing? |
This comment has been minimized.
This comment has been minimized.
arcto
commented
Dec 4, 2014
|
Only the last member of a |
This comment has been minimized.
This comment has been minimized.
|
@canndrew I would prefer making all traits op in too, but I'm not sure your inference system is a good idea. The precedent in most languages is to just infer types where there is no annotation. I.e. all annotated bindings have exactly the type the user specified. Where you can infer part of the type, one explicitly shows what should be filled in with e.g. an underscore (Agda, Rust), or the "diamond operator" (Java). The only time rust violates this principle is inferring lifetimes, I am not sure even sure that is a good idea. (Consider Also, opinions aside, I am not sure it is possible. Consider that multiple traits with the same method names can be in scope at the same time. Considering these things, I think |
This comment has been minimized.
This comment has been minimized.
|
We (the Rust team) discussed this RFC today. We are generally in favour of the changes, we would like to take an adjusted RFC where the question mark comes before The reason for keeping
here,
here, @P1start, if you are willing, could you make these changes to the RFC please? Then ping me and I will merge it. If you don't have time, let me know and I can take care of the changes too. Thanks! |
This comment has been minimized.
This comment has been minimized.
|
@nick29581 OK, I’ve updated the RFC with those changes. |
nrc
merged commit 2e74f61
into
rust-lang:master
Dec 6, 2014
This comment has been minimized.
This comment has been minimized.
|
Tracking issue: rust-lang/rust#19607 |
P1start commentedNov 29, 2014
•
edited by mbrubeck
Change the syntax for dynamically sized type parameters from
Sized? TtoT: Sized?, and change the syntax for traits for dynamically sized types totrait Foo: Sized?. Extend this new syntax to work withwhereclauses.cc #357
Rendered view