Skip to content

Commit a433137

Browse files
committed
show recursive data structures and name the consequence (garu++)
1 parent ea8f542 commit a433137

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Language/containers.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ Methods generally don't care whether their invocant is in a scalar, so
279279
280280
maps over a list of three elements, not of one.
281281
282+
=head1 Self Reference
283+
284+
Complex containers, like Array or Hash and relatives, can contain a reference
285+
to itself, forming recursive data structures. Please note that very few buildin
286+
functions and methods will detect infinite loops. It is the objective of the
287+
user to L<handle|/type/Promise#method_in> timeouts.
288+
289+
my @a;
290+
@a[0] = @a;
291+
put @a.perl;
292+
# OUTPUT«(my \Array_54878224 = [Array_54878224,])␤»
293+
282294
=head1 Type Constraints
283295
284296
Any container can have a type constraint in form of a L<type object|/language/typesystem#Type_objects> or a L<subset|/language/typesystem#subset>. Both can be place between a declarator and the variable name or after the trait L<of|/type/Variable#trait_is_dynamic>. The constraint is a property of the container, not the variable. Any (re-)binding may change the type constraint or remove the constraint altogether if bound to a value instead of a container. Introspection of type constraints on containers is provided by C<.VAR.of>.

0 commit comments

Comments
 (0)