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

Generics module is badly programmed #625

Closed
bmarkovic opened this issue Jan 17, 2021 · 5 comments
Closed

Generics module is badly programmed #625

bmarkovic opened this issue Jan 17, 2021 · 5 comments

Comments

@bmarkovic
Copy link

By "programming" I don"t mean programming as in programming languages but as in "setlist", I.e. defining the progression of the curriculum (the issue title might be a clickbait but I doubt it, I"m nothing like that 😁).

Specifically, generics3.rs exercise requires knowledge about traits, and the hint even starts with the following sentence: "To find the best solution to this challenge you"re going to need to think back to your knowledge of traits, specifically Trait Bound Syntax".

But Generics module come before Traits module in current progression of exercises. I"m assuming this is some reshuffle of rustlings from earlier state where someone simply failed to notice this dependency issue.

So this should be fixed ASAP, as Rust community is supposed to care big deal about preventing data races 😁

Bad jokes aside. I do think that having generics after traits actually makes much more sense even if this wasn"t the case., as they are, much like interfaces or subtyping, a less generic (whoops) form of polymorphism than parametric polymorphism.

@nickChenyx
Copy link

thanks for rust compiler, help me resolve this even not learn traits before.

help: consider restricting type parameter `T`
   |
21 | impl<T: std::fmt::Display> ReportCard<T> {
   |       ^^^^^^^^^^^^^^^^^^^

@Zerotask
Copy link
Contributor

@nickChenyx
I also stumbled over this problem. I added a help to the corresponding readme: #721
This is a generic constraint / bound to limit the types of T. In that case to types which implement the Display trait.

@thephet
Copy link

thephet commented Dec 3, 2021

Hi, I came here to say the same. Generics3 is impossible to solve with the knowledge acquired so far reading the rust book. There"s nothing in the generics chapter that would help to solve this.

I think this exercise needs to be re-written.

@codeofdusk
Copy link

I"ve also run into this (didn"t understand the hint and googled it to get here).

@shadows-withal
Copy link
Member

shadows-withal commented Jul 14, 2022

In 5.0-dev, I moved this to be a quiz after generics and traits - hopefully that helps. 5979d40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants