-
Notifications
You must be signed in to change notification settings - Fork 340
Fix Github ribbon and add new highlighted code example #1
Conversation
By changing `n` and `e` to `name` and `num` it makes it clearer what the bars are doing in each of the `for` loops and also makes it more obvious that those values are being closed over for use in the innermost print statement.
Note the commit message in that third commit. I feel that making those variable names less cryptic is a major win for first-time readers. |
Fix Github ribbon and add new highlighted code example
Fantastic |
It looks great. The only caveat is that post-demoding it has to look a bit different:
This is because |
It occurs to me, as a random thought, that if we supported infallible pattern matching in the parameter list, one could write the following:
which is cool, although maybe it doesn't quite look like what it means. Here the |
Will the current code example be valid for 0.4? |
Also that second revised code example looks fine (a little hesitant to start using the sigils in the introductory code example, but not that bad), but that first revised example looks bad enough that I'd want to just rewrite the code example entirely. |
@bstrie. No, it won't be valid for 0.4. |
@nikomatsakis I don't suppose that infallible-matching-in-parameter-lists is so uncontroversial and easily implemented that it could arrive in time for 0.4, is it? |
@bstrie uncontroversial, yes, easily implemented, no. It's actually not that hard...but it certainly wasn't on our priority list. One other comment about the example: the old version relied on an implicit copy of a ~str, which i believe generates a warning (or should). It'd probably be nice to have the opening example be warning free. |
No description provided.