Arrayref and hashref destructuring in subroutine signatures and assignment
Open
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 79
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice if we could do:
sub foo ([$x, $y]) {
say "$x, $y";
}
...instead of:
sub foo ($pair) {
my ($x, $y) = @$pair;
say "$x, $y";
}
...but also (if the previous has been done):
my { $x, $y } = { x => 5, y => 6 };
...or:
my { x => $value_x, y => $value_y } = { x => 5, y => 6 };
Would certainly help with users of RxPerl, who often write code like:
$observable->pipe(
op_pairwise,
op_map(sub ($pair) {
my ($old, $new) = @$pair;
...
}),
);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the arrayref and hashref destructuring examples in the issue; no source files or tests are named. Determine the proposed syntax and semantics for subroutine signatures and assignment, then define acceptance criteria through the Perl proposal process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100