File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -264,26 +264,33 @@ Identifiers can contain colon pairs. The entire colon pair becomes part
264
264
of the name of the identifier.
265
265
266
266
my $foo::bar = 1;
267
- my $foo:bar<2> = 2;
268
267
say MY::.keys;
269
268
# OUTPUT: «($=pod !UNIT_MARKER EXPORT $_ $! ::?PACKAGE
270
269
# GLOBALish $¢ $=finish $/ $foo:bar $foo:bar<2>
271
270
# $?PACKAGE)»
272
271
say OUR::.key; # OUTPUT: «foo»
273
272
274
273
The last sentence shows how the C < foo > package has been created
275
- automatically, as a deposit for variables in that namespace. Colon pairs
276
- in identifiers support interpolation. Please note that resolution of
274
+ automatically, as a deposit for variables in that namespace.
275
+
276
+ Identifiers can also contain single colons, and in that case they can
277
+ add I < symbols > within angle brackets. This is a mechanism that supports
278
+ interpolation; which is also supported by colonpairs if the interpolated
279
+ variable is inserted in parentheses. Please note that resolution of
277
280
names often happens at compile time, so interpolation values must be
278
281
known at compile time.
279
282
283
+ my $foo:bar<2> = 2;
280
284
constant $c = 42;
281
285
my $a:foo<42> = "answer";
282
- say $a:foo«$c»;
283
- # OUTPUT: «answer»
284
-
285
- Unicode superscript numerals are exponents and not part of an identifier;
286
- e.g. C < $x² > does the square of variable C < $x > . Subscript numerals are TBD.
286
+ say $a:foo«$c»; # OUTPUT: «answer»
287
+ my $buz = "qux";
288
+ my $bur::quux = 7;
289
+ say $bur::($buz); # OUTPUT: «7»
290
+
291
+ Unicode superscript numerals are exponents and not part of an
292
+ identifier; e.g. C < $x² > does the square of variable C < $x > . Subscript
293
+ numerals are TBD.
287
294
288
295
= head2 Term term:<>
289
296
You can’t perform that action at this time.
0 commit comments