Repository navigation
-mm=own: reverse and sort over class instances - #49
Merged
Merged
Conversation
reverse reads the element it swaps into a `let`, as sort's `temp` did: a `const` borrows the slot overwritten next. sort no longer assigns its optional comparator a default - a callback parameter that is assigned is one -mm=own knows nothing about, so a call of it with two elements was a use of them after a call that may release them; it gives a selectionSort helper the comparator or the default. Needs the compiler's copy of a string read out of a parameter the result borrows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…], a[i]]` The compiler's exchange of two places (spec 42) moves nothing in any model, where a swap through a local gave an object element a second owner under -mm=own. reverse over class instances now passes under own (array_reverse_class). sort over class instances (array_sort_class) is `// not own`: its comparison is handed on to selectionSort through a parameter, which has no callback facts yet. Needs the compiler's `ts.Swap`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sort gives its optional comparison on to selectionSort, and a callback given on through a parameter now keeps the facts of the functions passed for it (compiler spec 43), so array_sort_class is no longer `// not own`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/generics/lib.generics.ts
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.
Under
-mm=own,reverseandsortnow work over class instances. This needs the compiler's ASDAlexander77/TypeScriptCompiler#703.reverseandselectionSortswap elements with[a[i], a[j]] = [a[j], a[i]]. That compiles to an exchange that moves nothing in any memory model. Under own, a swap through a local gave an object element a second owner.array_reverse_classandarray_sort_class.array_sort_classgives its class atoString: sort's default comparison is compiled even when a comparator is given, and it converts each element to a string in every model.Suites with the compiler change (
tests.ps1, all four builds):array_sort_classin.🤖 Generated with Claude Code