Skip to content

chapter 7-3: clarify absolute and relative paths - #4831

Open
karolinepauls wants to merge 1 commit into
rust-lang:mainfrom
karolinepauls:ch-7-3-absolute-relative-paths
Open

karolinepauls wants to merge 1 commit into
rust-lang:mainfrom
karolinepauls:ch-7-3-absolute-relative-paths

Conversation

@karolinepauls

Copy link
Copy Markdown

Generally, less can do more if "less" brings clarity. This diff actually removes more words than it adds, though the line count increased due to added structure.

Changes:

  1. After the listing:

Added a short and gentle intro sentence, which states what the section will focus on:

In the listing, eat_at_restaurant calls add_to_waitlist in two different ways:

1.1. Removed sentence - redundant with the listing which already includes the // Absolute path comment:

The first time we call the add_to_waitlist function in eat_at_restaurant, we use an absolute path.

1.2. Removed sentence (non sequitur) - the specifics of the example don't determine that we can use crate to start an absolute path. The way Rust works determines that.

The add_to_waitlist function is defined in the same crate as eat_at_restaurant, which means we can use the crate keyword to start an absolute path.

1.3: The intro is now followed by two single-sentence descriptions of the two calls from the listing. Both follow a similar structure and are kept in separate paragraphs for presentation reasons.

2.2. Filesystem path analogy removed. It is obvious at this point, since the previous chapter illustrated it. At the same time, it bloats the text and makes it impossible to view the following absolute/relative path discussion and the listing at the same time.

  1. Choosing between absolute and relative paths:

Broken down into parts, reordered, added structure (headers and a list). Added style to highlight the contrast between absolute and relative paths.

3.1. Sentence removed, since this file already states it at the beginning (and the structure conveys it anyway):

Starting with a module name means that the path is relative.

Sidenote: I think that "means" here expresses an induction (=>) rather than equivalence <=>, since members of the same module can refer to each other (or themselves) by name, without their module name.

  1. Module and module item privacy - added a header to signal that we're done with Absolute and relative paths. I haven't thought about this header much.

This branch has not been deployed

No deployments
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.

1 participant