Issue #4326 : Fixed Inconsistent Type Inference Explanation in Collections Chapter#4327
Closed
sunnyallana wants to merge 2 commits into
Closed
Issue #4326 : Fixed Inconsistent Type Inference Explanation in Collections Chapter#4327sunnyallana wants to merge 2 commits into
sunnyallana wants to merge 2 commits into
Conversation
Author
|
@chriskrycho Kindly review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Clarify Type Inference Differences Between Vec and HashMap
Description
This PR identifies and adds an explanation about the differences in type inference behavior between
VecandHashMapcollections to address inconsistencies in the current documentation. The clarification helps readers understand why vectors require immediate type annotation when empty while hash maps can defer type inference until insertion.Changes Made
Added explanation to a paragraph in Chapter 8 (Common Collections, Hash Map) that identifies and explains the technical reason for the different initialization patterns between the two collection types.
Files Changed
src/ch08-03-hash-maps.mdMotivation
This change addresses a potential point of confusion for readers who might wonder why different collection types have different type inference behaviors despite both being homogeneous collections that store data on the heap.
Testing
The added explanation has been reviewed for technical accuracy and clarity.
Related Issues
Closes #4326 - Inconsistent Type Inference Explanation in Collections Chapter