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

Provide a facility for combining two Dict types #112

Open
tobyink opened this issue Sep 8, 2022 · 1 comment
Open

Provide a facility for combining two Dict types #112

tobyink opened this issue Sep 8, 2022 · 1 comment
Milestone

Comments

@tobyink
Copy link
Owner

tobyink commented Sep 8, 2022

Extracting this from #110.

Basically a shortcut for:

my $combined = Dict[
  $dict1->parameters->@*,
  $dict2->parameters->@*,
];

This could be a function, a method, an overload, etc. Just something to make it easier.

Complications:

  • If neither $dict1 nor $dict2 have a slurpy, neither should $combined. If one of them has a slurpy, $combined should inherit it. If $dict1 and $dict2 have slurpies typed HashRef[$s1] and HashRef[$s2], then $combined should have a slurpy typed $s1 | $s2. Otherwise $combined should have Slurpy[Any].
  • option to demote $dict2's keys to being optional in $combined?
@tobyink tobyink added this to the 2.0.0 milestone Sep 8, 2022
@tobyink tobyink modified the milestones: 2.0.0, bluesky Sep 8, 2022
@tobyink
Copy link
Owner Author

tobyink commented Sep 8, 2022

Further complication… what about this?

my $dict1 = Dict[ foo => HashRef ];
my $dict2 = Dict[ foo => ArrayRef ];
my $combined = combine( $dict1, $dict2 );

What values should $combined allow for foo? HashRef | ArrayRef even though an arrayref will confuse consumers of $dict1 and a hashref will confuse consumers of $dict2? HashRef & ArrayRef even though that matches nothing?

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

No branches or pull requests

1 participant