Repository navigation
lib.generics: explain why the array methods are free generic functions - #129
Merged
Merged
Conversation
…s (concat comment) The old comment dated from when the array methods were a generic static class Array<T>, with concat the one exception; all of them are free functions in __Array now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Comment-only change in
src/generics/lib.generics.ts.The comment above
concat("to prevent cycling initialization of T[][] ...") dates from 1d6962b (2024), when the array methods were a genericstatic class Array<T>andconcatwas the one exception, kept as a free function because itsT[][]signature made buildingArray<T>buildArray<Array<T>>without end. All the array methods are free generic functions in__Arraynow, so the comment is replaced with one that states the rule for all of them (concatandflatboth mentionT[][]).Checked with the current compiler: nested
concat(two and three levels, andArray<number[]>.concat) compiles and runs under gc and rc.🤖 Generated with Claude Code