-
Notifications
You must be signed in to change notification settings - Fork 37
Improvements to VarNamedVector #1098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
150de71
Change VNV to use Dict rather than OrderedDict
mhauru 30ac1d0
Change concretisation from map(identity, x) to a comprehension
mhauru 4ae0c6d
Improve tighten_types!! and loosen_types!!
mhauru 4c8b006
Fix use of set_transformed!!
mhauru c8b0b88
Fix push!! for VarInfos
mhauru 1f7152b
Change the default element types in VNV to be Union{}
mhauru 61c96b0
In untyped_vector_varinfo, don't rely on Metadata
mhauru 2a10be9
Code style
mhauru bb83d93
Run formatter
mhauru 99a7d32
In VNV, use typejoin rather than promote_type
mhauru 513edc5
Merge branch 'mhauru/varnamedvector-speed' into mhauru/vnv-speed2
mhauru d30eca8
Bump patch version to 0.38.4
mhauru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how Julia works on this front, but is it ever possible that changing what
viis bound to might invalidate the iteration overkeys(vi)? I think probably not, but ...??There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's not so much rebinding
vithat's the issue, but ifset_transformed!!were to mutatevi, then that might be problematic. I suppose it can't mutate it in a way such thatkeys(vi)would result in something different, so this probably can't error. But I'm a bit paranoid about this kind of code structure. Obviously, this predates this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, the
keys(vi)call I think is evaluated once when the loop is started, and it'll keep its reference to the originalvieven if the nameviis then bound to something else. Like inkeys(vi)is a lazy iterator though, so what I would feel dicey about is changing the set of keys invimid-iteration. This is a thing:which can result in weirdness:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think from a programming perspective, maybe the safest way would be to do a version of
keys(vi)that's eagerly evaluated, maybecollect(keys(vi))?But also from a human perspective it's quite easy to see that
keys(vi)can't be changed, so also happy to let it slide.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep it as is, because I'm pretty convinced it's okay (and not due to an implementation detail, but because
set_transformed!!has no business touching the keys), and lazy iterators are nice. Could add the call tocollectif it bothers you.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't bother me enough to want to do it.