Skip to content

Commit f705069

Browse files
committed
[glossary] explain thunk
1 parent 7136f93 commit f705069

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

S99-glossary.pod

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,29 @@ code to L</DWIM> or from an interrupted thought process.
844844

845845
=head2 thread
846846

847+
=head2 thunk
848+
849+
A piece of code that isn't immediately executed, but doesn't have an
850+
independent scope.
851+
852+
Examples for thunks:
853+
854+
my $a;
855+
$a = 1 if 1;
856+
# ^^^^^^ thunk
857+
858+
class MyClass {
859+
has $.attr = 42 + 23;
860+
# ^^^^^^^ thunk
861+
862+
method x($attr = say 42) {
863+
# ^^^^^^ thunk
864+
}
865+
}
866+
867+
$a = 1 || say 2;
868+
# ^^^^^ thunk
869+
847870
=head2 TimToady
848871

849872
L</IRC> screen name for Larry Wall, creator of Perl. The name comes from the

0 commit comments

Comments
 (0)