Skip to content

Conversation

@mgeisler
Copy link
Collaborator

When teaching the class, I’ve noticed that raw strings and byte strings tend to cause confusion. The slide is meant to be a friendly introduction and show how Rust is similar to other languages like C and C++. Instead, the string types cause a ton of questions which are unnecessary at this early point.

The information is still there, but now in the form of a speaker note.

When teaching the class, I’ve noticed that raw strings and byte
strings tend to cause confusion. The slide is meant to be a friendly
introduction and show how Rust is similar to other languages like C
and C++. Instead, the string types cause a ton of questions which are
unnecessary at this early point.

The information is still there, but now in the form of a speaker note.
@mgeisler mgeisler requested a review from rbehjati April 27, 2023 16:53
Copy link
Contributor

@rbehjati rbehjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks.

There are a few syntaxes which are not shown above:

- Raw strings allow you to create a `&str` value with escapes disabled: `r"\n"
== "\\\\n"`. You can embed double-quotes by using an equal amount of `#` on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
== "\\\\n"`. You can embed double-quotes by using an equal amount of `#` on
== "\\n"`. You can embed double-quotes by using an equal amount of `#` on

I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are actually right according to the Commonmark spec: https://spec.commonmark.org/0.30/#example-338. However, I looked at the page and this is what I see with the weird number of backslashes:

image

I think there is a bug somewhere. I briefly tested https://github.com/raphlinus/pulldown-cmark and it handles the backticks correctly from what I can tell. So perhaps they get mangled further down the line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried disabling our preprocessors and the result is the same. I filed rust-lang/mdBook#2079 to track this.

@mgeisler mgeisler merged commit f895ffc into main Apr 27, 2023
@mgeisler mgeisler deleted the simplify-strings branch April 27, 2023 17:57
NoahDragon pushed a commit to wnghl/comprehensive-rust that referenced this pull request Jul 19, 2023
When teaching the class, I’ve noticed that raw strings and byte
strings tend to cause confusion. The slide is meant to be a friendly
introduction and show how Rust is similar to other languages like C
and C++. Instead, the string types cause a ton of questions which are
unnecessary at this early point.

The information is still there, but now in the form of a speaker note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants