Skip to content
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

Add LazyMergedMap for merging Model objects #105

Merged
merged 8 commits into from
Oct 21, 2024
Merged

Conversation

jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Oct 17, 2024

Possibly resolution to #102, not high priority to land right away just putting something out there.

Has a few failing tests right now which I can look at if we want to move forward.

We might want to benchmark this also if we decide to land it.

@jakemac53 jakemac53 changed the title Lazy merged map Add LazyMergedMap for merging Model objects Oct 17, 2024
Copy link
Contributor

@davidmorgan davidmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Yes, I think we almost certainly want this, the only way I could see avoiding it is if we require that macros only make one query.

There is a TODO for merging the model into the current scope here

_accumulatedModel = model;

which could directly use this, not sure if that's useful to do in this PR or not.

pkgs/dart_model/test/lazy_merged_map_test.dart Outdated Show resolved Hide resolved
pkgs/dart_model/lib/src/lazy_merged_map.dart Show resolved Hide resolved
@jakemac53
Copy link
Contributor Author

There is a TODO for merging the model into the current scope here

Oh nice, I will add that

@jakemac53 jakemac53 merged commit 47b2e10 into main Oct 21, 2024
45 checks passed
@jakemac53 jakemac53 deleted the lazy-merged-map branch October 21, 2024 20:29
_accumulatedModel = model;
_typeSystem = null;
if (_accumulatedModel case var accumulated?) {
accumulated.mergeWith(model);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should be _accumulatedModel = ... :)

I guess we don't have any test coverage for this :) meaning we never use the type system after a second query.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants