Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Mistake in chapter 19.1, under Safe Abstractions #1995

Closed
Zoybean opened this issue Jun 17, 2019 · 1 comment
Closed

Possible Mistake in chapter 19.1, under Safe Abstractions #1995

Zoybean opened this issue Jun 17, 2019 · 1 comment

Comments

@Zoybean
Copy link
Contributor

Zoybean commented Jun 17, 2019

The following paragraph of Chapter 19.1 describes an attempt to safely implement a mutable slice split function:

This function first gets the total length of the slice. Then it asserts that the index given as a parameter is within the slice by checking whether it’s less than or equal to the length. The assertion means that if we pass an index that is greater than the index to split the slice at, the function will panic before it attempts to use that index.

It looks like this should not say "if we pass an index that is greater than the index", but rather "if we pass an index that is greater than the length", as the comparison is between the index and the length, not two indices.

Zoybean added a commit to Zoybean/book that referenced this issue Jun 18, 2019
@carols10cents
Copy link
Member

Looks like "resolves issue" isn't one of the magic github phrases; this was fixed in #1999.

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

No branches or pull requests

2 participants