Skip to content

Fix code errors, typos, and grammar across 19 files#28

Open
jwiegley wants to merge 26 commits intocognitive-engineering-lab:mainfrom
jwiegley:fix/review-corrections
Open

Fix code errors, typos, and grammar across 19 files#28
jwiegley wants to merge 26 commits intocognitive-engineering-lab:mainfrom
jwiegley:fix/review-corrections

Conversation

@jwiegley
Copy link

Summary

  • Fix 8 code correctness issues: this.this-> in C++ examples, uninitialized loop variable (UB), twice() computing square instead of double, math error in normalization check, Optional<Box<T>>Option<Box<T>>, ErrorB copy-paste error, snake_case violations in Rust examples, and camelCase variable names in Rust code
  • Fix 20+ grammar/spelling errors across the book: typos ("beacause", "accesssible", "idomatic", "desireable", etc.), missing articles, subject-verb disagreements, duplicated words, and missing prepositions
  • Fix broken empty link for the Concurrency chapter in SUMMARY.md
  • Clarify confusing wording: "constructors (proper constructors)" → "tuple struct constructors", and other minor prose improvements

Each fix is in its own atomic commit for easy review.

Test plan

  • Verify mdbook build succeeds without errors
  • Spot-check rendered output for the modified chapters
  • Verify C++ code examples compile (especially this-> fixes and loop variable initialization)
  • Verify Rust code examples compile (especially Option<Box<T>> fix and snake_case renames)

🤖 Generated with Claude Code

jwiegley and others added 26 commits February 11, 2026 11:27
In C++ 'this' is a pointer, not a reference. Using 'this.member' will
not compile. Changed to 'this->member' in inheritance_and_reuse.md and
object_identity.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The for loops in placement_new.md declared 'std::size_t i;' without
initialization, producing undefined behavior. Added '= 0' to both
loop variable declarations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The function named 'twice' was computing n * n (squaring) instead of
n * 2 (doubling). Fixed in both the C++ and Rust examples in the
function-to-pointer section of promotions_and_conversions.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The unit vector check was computing x^2 + xy instead of x^2 + y^2.
Changed 'v.y * v.x' to 'v.y * v.y' in the Normalized::from_vec2
method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Used the C++ name 'Optional' instead of the Rust type name 'Option'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three instances of the ErrorB C++ struct had a message string saying
"ErrorA was produced" instead of "ErrorB was produced".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renamed might_throw_A and might_throw_B to might_throw_a and
might_throw_b to follow Rust's snake_case naming convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renamed twicePtr, ctorPtr, methodPtr, closureRes to twice_ptr,
ctor_ptr, method_ptr, closure_res in the function-to-pointer Rust
example in promotions_and_conversions.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Changed 'both requires' to 'both require'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 'idomatic' -> 'idiomatic'
- 'defintion' -> 'definition'
- 'using and Rust's' -> 'using Rust's' (extra word)
- 'C++ template' -> 'a C++ template' (missing article)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 'with with' -> 'with' (duplicate word)
- 'can either be overloaded either' -> 'can be overloaded either'
- 'operator' -> 'operators' (missing plural)
- 'desireable' -> 'desirable'

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 'iterable sequence' -> 'an iterable sequence' (missing article)
- 'accessiable' -> 'accessible' (2 occurrences)
- 'invaliding' -> 'invalidating'

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 'Even when the a client of the library is needs' -> 'Even when a
  client of the library needs'
- 'an be used' -> 'can be used'
- 'can managing' -> 'can manage'
- Replace TODO comment with actual link to visitor pattern chapter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 'Unless otherwise state' -> 'Unless otherwise stated' (both files)
- 'the The Rust Unstable Book' -> 'the Rust Unstable Book'
- 'what is need' -> 'what is needed'

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "remaning" → "remaining", "accesssible" → "accessible",
"accessbile" → "accessible", and "is not breaking change" →
"is not a breaking change".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "are is often used" → "are often used" and add missing space
before "trait" in DerefMut link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "are in-band value that indicates" → "are in-band values
that indicate".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "intended to used be indices" → "intended to be used as indices",
"This results a situation" → "This results in a situation", and
clarify "constructors (proper constructors)" → "tuple struct
constructors".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "in few more ways" → "in a few more ways" and "traits
implementations" → "trait implementations".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "others cases" → "other cases" and remove duplicated "by" in
"handled by instead by".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix "The most approach depends" → "The best approach depends".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The concurrency chapter doesn't exist yet, so remove the empty
link brackets to avoid a broken link in the rendered book.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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

Comments