Skip to content

Commit 81bd38c

Browse files
committed
Bind of Nil with := is primitive
(But parameter binding is ::= semantics, which treats Nil as if no arg had been passed.)
1 parent c92cded commit 81bd38c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

S02-bits.pod

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Synopsis 2: Bits and Pieces
1313

1414
Created: 10 Aug 2004
1515

16-
Last Modified: 6 Jul 2011
17-
Version: 235
16+
Last Modified: 2 Aug 2011
17+
Version: 236
1818

1919
This document summarizes Apocalypse 2, which covers small-scale
2020
lexical items and typological issues. (These Synopses also contain
@@ -2237,16 +2237,17 @@ C<Nil.Numeric> returns 0 with a warning. Any undefined method call
22372237
on C<Nil> returns C<Nil>, so that C<Nil> propagates down method
22382238
call chains.
22392239

2240-
Assigning C<Nil> to any scalar container causes the
2241-
container to throw out any contents and restore itself to an
2242-
uninitialized state (after which it will contain a type object
2243-
appropriate to the declared type of the container, where C<Any>
2244-
is the default type). Binding of C<Nil> has a similar result, except that binding
2245-
C<Nil> to a parameter with a default causes that parameter to be set to its
2246-
default value rather than an undefined value, as if the argument had not
2247-
been supplied.
2248-
2249-
Assigning or binding C<Nil> to any composite container (such as an
2240+
Assigning C<Nil> to any scalar container causes the container to
2241+
throw out any contents and restore itself to an uninitialized state
2242+
(after which it will contain a type object appropriate to the declared
2243+
type of the container, where C<Any> is the default type). Binding of
2244+
C<Nil> with C<:=> simply puts Nil in the container. However, binding
2245+
C<Nil> to a parameter (C<::=> semantics) works more like assignment;
2246+
passing C<Nil> to a parameter with a default causes that parameter
2247+
to be set to its default value rather than an undefined value, as if
2248+
the argument had not been supplied.
2249+
2250+
Assigning C<Nil> to any composite container (such as an
22502251
C<Array> or C<Hash>) empties the container, resetting it back to an
22512252
uninitialized state. The container object itself then becomes undefined.
22522253
(Asssignment of C<()> leaves it defined.)

0 commit comments

Comments
 (0)