Potential Semantic Clarity #2347
Closed
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.
Hello! Firstly, I would like to thank all the contributors for the awesome tour of Scala Lang. While going through the example, the usage of
Node[Bird]
type for birdList threw me in a loop for a moment. The location of usage has been proposed as a change for both demonstration purposes and as a potential change.I understand traits can be used to describe a type, but in this instance wouldn't it be clearer to say
ListNode[Bird]
instead? Seeing that the value name –birdList– indicates we are going for a list. From what I can surmise, the Node trait can be implemented by say, a GraphNode which uses the prepend method in some way (one might argue it to be a convoluted use case). For the sake of clarity and consistency with the semantic meaning of the example, I believeListNode[Bird]
would be a better choice.