-
Notifications
You must be signed in to change notification settings - Fork 19
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
Remove type parameter default on functions and methods #32
Comments
I don't know exactly where these discussions were, but the language team wants to basically back out of the type parameter defaults feature for functions altogether. It makes sense to remove these while they are still duds. |
This was of course contrary to my hope and the library API evolution use case I wanted to have available. |
I can see why they want to remove it, it is an extra feature which might not be needed. Maybe the working related to HKTs could shed some light on what is needed (I assume that some type-defaults would be really neat to have there). But I am still a bit surprised that types and traits are treated differently compared to functions. |
if functions were treated like struct and trait then: fn id<T=u32>(t: T) -> T { t }
id(2); // calls id::<u32>()
id("hi"); // tries to call id::<u32>() and produces an error
id::<&str>("hi"); // ok which is very limited! |
Wouldn't the above example with |
True, the |
See rust-lang/rust#30724 and https://gist.github.com/nikomatsakis/760c6a67698bd24253bf
These are warnings in the nightly.
The text was updated successfully, but these errors were encountered: