Re:Curl is C
by naasking on Tuesday March 28, 2017 @01:46PM
(#13978792)
Yes I get it, it just seems unnecessary to require every type parameter to be used. Do you have a link to the discussion motivating this choice?
[ Parent
| on HN ]
Re:Curl is C
by steveklabnik on Tuesday March 28, 2017 @02:17PM
(#13979148)
In my understanding, it has to do with variance. This happened a very long time ago, before 1.0, and so I don't know where the discussion happened, off the top of my head.
Found it: https://github.com/rust-lang/rfcs/blob/master/text/0738-vari...
It still seems bizarre to me that a purely type-level expression is forced by an effectively non-existent term. That RFC specifically states that the main problem is that the results of variance inference are largely erased by assuming invariance. That seems like a sensible default for unused type parameters too.
It seems from the conclusion of that post that PhantomData only survived because this was the smallest change they had to make to get this all to work better, and because some of this PhantomData could be used for other analyses in the compiler (although it's not clear if better type information could have replaced these uses anyway).