Skip to content

Instantly share code, notes, and snippets.

@skids
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skids/eee195166e8ded9393c2 to your computer and use it in GitHub Desktop.
Save skids/eee195166e8ded9393c2 to your computer and use it in GitHub Desktop.
Perl6 Rule of Comma
< Is there a top-level comma? >
YES NO
< Are you in flattening context? > < Does the destination bind to a $ or unsigilled? >
YES NO YES NO
<protected by .item or $() ?> Stays the same Stays the same Decontainerize
YES NO
Stays the same Interpolate
$_ for flat 1, $[2,3]; # YES, YES, YES: 1, [2,3]
$_ for flat 1, [2,3]; # YES, YES, NO: 1,2,3
$_ for flat [2,3],; # YES, YES, NO: 2,3
$_ for flat 1, [2,3]; # YES, YES, NO: 1,2,3
$_ for 1,[2,3]; # YES, NO: 1,[2,3]
my $a = [2,3]; # NO, YES: [2,3]
my \a = [2,3]; # NO, YES: [2,3]
$_ for flat = [2,3]; # NO, NO: 2,3
# Assuming list assignment still flattens, which apparently is still TBD:
my @a = [2,3]; # NO, NO: 2,3
my @a = [2,3],; # YES, YES, NO: 2,3
my @a = 1, $[2,3]; # YES, YES, YES: 1, [2,3]
my @a = 1, [2,3]; # YES, YES, NO: 1,2,3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment