fix(intro2): Changed intro2 to be a name error, not a format string error #1735
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think intro2 is too difficult to be the very first real exercise, and we're scaring away some students unnecessarily.
TL;DR: I've made a tweak to intro2 to cause a much friendlier compiler error.
My Case Against The Existing Exercise
The existing error for
intro2
is more difficult to understand compared with subsequent exercises. That's not right, the Rustlings exercises are otherwise in ascending order of difficulty. The first one should be the easiest!The existing intro2 error is:
This is terrifying as an error! There's not even a hint or compiler help to aid us! Even existing programmers coming from other languages might be stumped:
{}
is called a 'positional argument'?println!
(they might reasonably think).I don't think there's a need to teach the student about format strings right here, we're about to use them multiple times in a much friendlier way in the very next exercise:
variables
.If this exercise were named
formatstring1
I would understand, but it's not, it's namedintro2
:This is a poor intro to Rustlings, but one we can fix easily.
My Case For The Proposed Change
I propose the first exercise should both showcase Rust's fantastic errors AND show that the compiler can often tell you how to solve your mistakes with help text.
I propose changing
intro2
to the following, but I would agree with any proposal that has a clear error with correct compiler help text.The compiler error for this is much simpler, AND comes with a correct help suggestion. The error is:
The student only needs to read the help line to know how to fix the error. 🎉