Comments (4)
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.
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.
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.
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)
- Test in CI that we're in sync with problem-specifications HOT 2
- Simply linked list test error HOT 1
- Pin test runner to a specific version HOT 1
- Document / reconsider `topics` field in track config HOT 1
- Improve example solution testing scripts
- CamelCase test unintentionally removed from acronym exercise HOT 2
- Building a training set of tags for rust HOT 25
- Tests fail with no output HOT 15
- Tests don't pass when sending Cargo.toml with optional dependency HOT 1
- Remove all util functions from test files HOT 4
- Test in CI that stubs don't generate clippy warnings HOT 1
- Move more CI tests to rust tooling
- Concepts for this track are not displayed HOT 1
- word-count: change interface from u32 to usize
- test type_override fails even when correct solution is made in macros lesson HOT 1
- Performance issue about the Isogram problem approach HOT 1
- Add test that templates match generated test suite HOT 5
- One of two-bucket's test case is wrong HOT 3
- Improve exercise order
- new test case for Phone Number HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.