More modernization - #9089
Open
anderseknert wants to merge 1 commit into
Open
Conversation
And allocation Pokémons caught. Gotta catch 'em all! - Add `VarSet.DeleteFunc` which largerly replaces the `VarSet.Diff` function, just diffing in place rather than by creating a new `VarSet` — one which we almost never used more than temporarily - Use `unknownRef` in eval over `unknown` where possible as `Ref` -> any boxing always allocates - Get rid of a few more custom comparison functions in favor of those in the stdlib.. - ..and some more code replaced with stdlib/our helpers to reduce lines of code and help with readability - Fixed a few random heap allocations Signed-off-by: Anders Eknert <anders.eknert@apple.com>
srenatus
approved these changes
Aug 26, 2026
| // implementations to *Term in util.Map, util.MapKeys, etc. | ||
| func ToTerm[T Value](v T) *Term { | ||
| return NewTerm(v) | ||
| } |
Contributor
There was a problem hiding this comment.
Would we need/want an interning variant?
Member
Author
There was a problem hiding this comment.
Not with my laptop today, but I think InternedTerm should work as it’s already generic. I should add something to the comment here though as that’s preferable for anything that may be interned.
Member
Author
There was a problem hiding this comment.
Oh no, sorry, this one takes Value types rather than primitives. Not sure how we’d best take a Value and check if there’s an interned term containing that 🤔 But yeah, that would certainly be nice if we could.
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.
And allocation Pokémons caught. Gotta catch 'em all!
VarSet.DeleteFuncwhich largerly replaces theVarSet.Difffunction, just diffing in place rather than by creating a newVarSet— one which we almost never used more than temporarilyunknownRefin eval overunknownwhere possible asRef->anyboxing always allocates