cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
504 stars 82 forks source link

Confusing syntax `(self.postprocess)(n)` #125

Open redexp opened 9 months ago

redexp commented 9 months ago

URL to the section with problem: Ch13, last quiz, last question

Description of the problem:

impl<F: ___(i32) -> i32> Analyzer<F> {
    //...
    pub fn pipeline(&self, n: i32) -> i32 {
        // ...
        (self.postprocess)(n)
    }
}

That last return was surprising for me, why you put self.postprocess in brackets. I thought it's a bug. I tried without brackets and get very helpful error, but still. I think this should be explained before the quiz.

Also this placeholder ___(i32) was very confusing for me. My first thoughts was like "wtf?! I skip some chapter where this syntax explained?" I closed quiz, scrolled around current chapter. Open quiz again. Next thought "Maybe it's like that underscore don't care argument, but why there three underscores and not one?!" And only when I looked on answer options I understand this "syntax" means.

As a fix for placeholder maybe use emoji? like

impl<F: ❓(i32) -> i32> Analyzer<F> {