Giter Club home page Giter Club logo

Comments (4)

petertseng avatar petertseng commented on July 23, 2024

Good question. Looking at #52 where it was added I don't think there is any specific reason. If I had to guess a reason, it would be that the tests were copied from Go (where generics are unsupported) and/or Ruby (where generics are not really necessary)

I definitely have seen someone submit a solution using generics.

It could be possible to make the tests less discouraging in this regard. What are your ideas on how to do this?

I'd like to investigate a few other problems in this track to see if they would be appropriate for generics too. Seems like a good time to do that now that we are having this conversation.

from rust.

Jonah-Horowitz avatar Jonah-Horowitz commented on July 23, 2024

I'd say that it would be more encouraging for generics if we simply changed line 11 in the first test to read let mut buffer = CircularBuffer::<char>::new(1); or let mut buffer: CircularBuffer<char> = CircularBuffer::new(1); instead of let mut buffer = CircularBuffer::new(1); as the latter made it far too confusing to create a new method that returned type CircularBuffer<T> and I had to hard-code a return type of CircularBuffer<char> there.
All the other tests work fine without any changes, but we could encourage generics even more by including more tests which store non-char values such as values of type isize and/or String.
I don't recall seeing any other problems in the rust track which seemed to be asking for generics like this one, but I might have forgotten about them.

from rust.

petertseng avatar petertseng commented on July 23, 2024

For @EduardoBautista and @IanWhitney let's discuss whether generics is something we want. Any reason we would not want it, such as too much for students to think about? I do not think it is too bad, besides circular-buffer is currently the last exercise in the track. The Rust book even has a nice section about generics that we could link to in the comments of the test if we think there will be trouble. It's a good thing to learn at some point.

@Jonah-Horowitz would you like to do the honors of making the change and sending in the PR? I'm sure I could but for various reason I will not be able to do it myself for a few days so it would be a good chance for you.

from rust.

IanWhitney avatar IanWhitney commented on July 23, 2024

Generics are part of the custom set exercise as well.

As with other discussions about our problem order, there is probably a good way to order problems to introduce generics.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.