File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
= TITLE Meta-Object Protocol
4
4
5
+ = SUBTITLE Introspection and the Perl 6 Object System
6
+
5
7
TODO
6
8
7
9
= head1 Metamethods
8
10
9
- TODO
11
+ These are introspective macros that resemble method calls.
12
+
13
+ Note that if you want to call a method by the same name of an object, use
14
+ quotes around the method name to call it indirectly:
15
+
16
+ class MY-CLASSES-ARE-ALL-CAPS {
17
+ method WHY { "I DON'T KNOW" }
18
+ }
19
+ my $c = MY-CLASSES-ARE-ALL-CAPS.new;
20
+ say $c.WHY # "(MY-CLASSES-ARE-ALL-CAPS)"
21
+ say $c."WHY"() # "I DON'T KNOW"
10
22
11
23
= head2 X < WHAT|syntax,WHAT >
12
24
@@ -40,4 +52,11 @@ The object has a valid concrete representation.
40
52
41
53
Returns the underlying C < Scalar > object, if there is one.
42
54
55
+ The presence of a C < Scalar > object indicates that the object is "itemized".
56
+
57
+ .say for (1, 2, 3); # not itemized, so "1\n2\n3\n"
58
+ .say for [1, 2, 3]; # itemized, so "1 2 3\n"
59
+ say (1, 2, 3).VAR ~~ Scalar; # False
60
+ say [1, 2, 3].VAR ~~ Scalar; # True
61
+
43
62
= end pod
You can’t perform that action at this time.
0 commit comments