2kF2g0nQpVE0GzrKaEE7HA changeset

Changeset343738383139 (b)
ParentNone (a)
ab
0+15:39 ~/g/code/p6/crypt$ nom handles.pl
0+foo(a, b)
0+bar(A, B)
0+DEBUG: Methods are:
0+(submethod BUILD(User , Mu *%_) { ... }, method bar(User , $arg1, $arg2, Mu *%_) { ... }, method foo(Mu , |$c, Mu *%_) { ... })
0+Method BUILD:
0+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+Method bar:
0+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '$arg1', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
0+- param '$arg2', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+Method foo:
0+- param '', type: Muall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '$c', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: yes, parcel: no, slurpy: no, optional: no, invocant: no, pos: no
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+DEBUG: Commands are:
0+("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ().list.item).hash
0+Commands:("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ().list.item).hash
0+15:40 ~/g/code/p6/crypt$ perl6 handles.pl
0+foo(a, b)
0+bar(A, B)
0+DEBUG: Methods are:
0+(submethod BUILD(User , Mu *%_) { ... }, method bar(User , $arg1, $arg2, Mu *%_) { ... }, method foo(Mu , |$c, Mu *%_) { ... })
0+Method BUILD:
0+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+Method bar:
0+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '$arg1', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
0+- param '$arg2', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+Method foo:
0+- param '', type: Muall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
0+- param '$c', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: yes, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
0+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
0+DEBUG: Commands are:
0+("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ("c",).list.item).hash
0+Commands:("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ("c",).list.item).hash
0+15:40 ~/g/code/p6/crypt$ cat handles.pl
0+#! /usr/bin/env perl6
0+
0+use v6;
0+
0+class Engine {
0+    method foo($arg1, $arg2) { say "foo($arg1, $arg2)"; }
0+}
0+
0+class User {
0+    has $!engine handles <foo>;
0+
0+    submethod BUILD() { $!engine = Engine.new; }
0+
0+    method bar($arg1, $arg2) { say "bar($arg1, $arg2)"; }
0+}
0+
0+my User $u .= new;
0+
0+$u.foo('a', 'b');
0+$u.bar('A', 'B');
0+
0+say "Commands:", objCommands($u).perl;
0+
0+sub objCommands($obj) {
0+    say "DEBUG: Methods are:\n", $obj.^methods.perl;
0+    sub params($method) {
0+        say "Method {$method.name}:";
0+        for $method.signature.params {
0+            say "- param '{.name}'",
0+                ", type: {.type.perl}",
0+                ", constraints: {.constraints}",
0+                ", type_captures: {.type_captures}",
0+                # RAKUDO: NYI 2012-07-15
0+                #", read_only: {.read_only ?? 'yes' !! 'no'}",
0+                ", rw: {.rw ?? 'yes' !! 'no'}",
0+                ", copy: {.copy ?? 'yes' !! 'no'}",
0+                ", named: {.named ?? 'yes' !! 'no'}",
0+                ", named_names: {.named_names.perl}",
0+                ", capture: {.capture ?? 'yes' !! 'no'}",
0+                ", parcel: {.parcel ?? 'yes' !! 'no'}",
0+                ", slurpy: {.slurpy ?? 'yes' !! 'no'}",
0+                ", optional: {.optional ?? 'yes' !! 'no'}",
0+                ", invocant: {.invocant ?? 'yes' !! 'no'}",
0+                #", multi_invocant: {.multi_invocant ?? 'yes' !! 'no'}",
0+                ", pos: {.positional ?? 'yes' !! 'no'}"
0+                ;
0+        }
0+
0+        $method.signature.params
0+            ==> grep { .positional && !.invocant }
0+            ==> map { .name.substr(1) }
0+    }
0+    my %commands = map { $^m.name => params($m) }, $obj.^methods;
0+
0+    say "DEBUG: Commands are:\n", %commands.perl;
0+
0+    return %commands;
0+}
0+15:41 ~/g/code/p6/crypt$ perl6 --version
0+This is perl6 version 2012.06 built on parrot 4.5.0 revision 0
0+15:45 ~/g/code/p6/crypt$ nom --version
0+This is perl6 version 2012.06-87-g499cc68 built on parrot 4.5.0 revision RELEASE_4_5_0
0+15:45 ~/g/code/p6/crypt$
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--- Revision None
+++ Revision 343738383139
@@ -0,0 +1,104 @@
+15:39 ~/g/code/p6/crypt$ nom handles.pl
+foo(a, b)
+bar(A, B)
+DEBUG: Methods are:
+(submethod BUILD(User , Mu *%_) { ... }, method bar(User , $arg1, $arg2, Mu *%_) { ... }, method foo(Mu , |$c, Mu *%_) { ... })
+Method BUILD:
+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+Method bar:
+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '$arg1', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
+- param '$arg2', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+Method foo:
+- param '', type: Muall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '$c', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: yes, parcel: no, slurpy: no, optional: no, invocant: no, pos: no
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+DEBUG: Commands are:
+("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ().list.item).hash
+Commands:("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ().list.item).hash
+15:40 ~/g/code/p6/crypt$ perl6 handles.pl
+foo(a, b)
+bar(A, B)
+DEBUG: Methods are:
+(submethod BUILD(User , Mu *%_) { ... }, method bar(User , $arg1, $arg2, Mu *%_) { ... }, method foo(Mu , |$c, Mu *%_) { ... })
+Method BUILD:
+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+Method bar:
+- param '', type: Userall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '$arg1', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
+- param '$arg2', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+Method foo:
+- param '', type: Muall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: no, parcel: no, slurpy: no, optional: no, invocant: yes, pos: yes
+- param '$c', type: Anyall(), type_captures: , rw: no, copy: no, named: no, named_names: ().list, capture: yes, parcel: no, slurpy: no, optional: no, invocant: no, pos: yes
+- param '%_', type: Muall(), type_captures: , rw: no, copy: no, named: yes, named_names: ().list, capture: no, parcel: no, slurpy: yes, optional: no, invocant: no, pos: no
+DEBUG: Commands are:
+("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ("c",).list.item).hash
+Commands:("BUILD" => ().list.item, "bar" => ("arg1", "arg2").list.item, "foo" => ("c",).list.item).hash
+15:40 ~/g/code/p6/crypt$ cat handles.pl
+#! /usr/bin/env perl6
+
+use v6;
+
+class Engine {
+ method foo($arg1, $arg2) { say "foo($arg1, $arg2)"; }
+}
+
+class User {
+ has $!engine handles <foo>;
+
+ submethod BUILD() { $!engine = Engine.new; }
+
+ method bar($arg1, $arg2) { say "bar($arg1, $arg2)"; }
+}
+
+my User $u .= new;
+
+$u.foo('a', 'b');
+$u.bar('A', 'B');
+
+say "Commands:", objCommands($u).perl;
+
+sub objCommands($obj) {
+ say "DEBUG: Methods are:\n", $obj.^methods.perl;
+ sub params($method) {
+ say "Method {$method.name}:";
+ for $method.signature.params {
+ say "- param '{.name}'",
+ ", type: {.type.perl}",
+ ", constraints: {.constraints}",
+ ", type_captures: {.type_captures}",
+ # RAKUDO: NYI 2012-07-15
+ #", read_only: {.read_only ?? 'yes' !! 'no'}",
+ ", rw: {.rw ?? 'yes' !! 'no'}",
+ ", copy: {.copy ?? 'yes' !! 'no'}",
+ ", named: {.named ?? 'yes' !! 'no'}",
+ ", named_names: {.named_names.perl}",
+ ", capture: {.capture ?? 'yes' !! 'no'}",
+ ", parcel: {.parcel ?? 'yes' !! 'no'}",
+ ", slurpy: {.slurpy ?? 'yes' !! 'no'}",
+ ", optional: {.optional ?? 'yes' !! 'no'}",
+ ", invocant: {.invocant ?? 'yes' !! 'no'}",
+ #", multi_invocant: {.multi_invocant ?? 'yes' !! 'no'}",
+ ", pos: {.positional ?? 'yes' !! 'no'}"
+ ;
+ }
+
+ $method.signature.params
+ ==> grep { .positional && !.invocant }
+ ==> map { .name.substr(1) }
+ }
+ my %commands = map { $^m.name => params($m) }, $obj.^methods;
+
+ say "DEBUG: Commands are:\n", %commands.perl;
+
+ return %commands;
+}
+15:41 ~/g/code/p6/crypt$ perl6 --version
+This is perl6 version 2012.06 built on parrot 4.5.0 revision 0
+15:45 ~/g/code/p6/crypt$ nom --version
+This is perl6 version 2012.06-87-g499cc68 built on parrot 4.5.0 revision RELEASE_4_5_0
+15:45 ~/g/code/p6/crypt$