Perl / Perl/PPCs

[PPC0021] - more clarification for the short circuit behavior

Open
#63 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
79
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Given the following code

@{ $possibly_undef?->[0] }[0..10]

What should happen if $possibly_undef is undef? had it been a chain, then it's obvious that the final slice operation would be skipped. Do we want this behavior also in the event that an equivalent expression has been made that just so happens to not be in a "chain"?

I vote yes, b/c the logic for skipping deeper parts of the chain (ostensibly) is "given that i'm trying to fetch some value deep inside this thingy, all fetching of values will be obviously undef, so let's just return undef now". That would apply to this use case also.

I'll happily submit a PR including this as a more peculiar case once i get the feeling that this I am correct that this behavior is correct

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Perl expression in the issue and compare its proposed behavior with the short-circuit behavior of an equivalent chain. Resolve whether the final slice is skipped when $possibly_undef is undef, then document the agreed semantics clearly in the PPC proposal. No implementation file or test is named, so the scope must be established before coding.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.