You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C<^mro> prints the class hierarchy of this empty grammar, showing all the superclasses. And these superclasses have their very own methods. Defining a method in that grammar might clash with the ones inhabiting the class hierarchy:
1603
+
C<^mro> prints the class hierarchy of this empty grammar, showing all the
1604
+
superclasses. And these superclasses have their very own methods. Defining a
1605
+
method in that grammar might clash with the ones inhabiting the class hierarchy:
1604
1606
1605
1607
=begincode :skit-test<throws exception>
1606
1608
grammar g {
@@ -1613,9 +1615,18 @@ say g.parse('defined');
1613
1615
# /tmp/dZ3evir0pb line 1 in block <unit> at /tmp/dZ3evir0pb line 1»
1614
1616
=endcode
1615
1617
1616
-
C«item» seems innocuous enough, but it is a L<C<sub> defined in class C<Mu>|/routine/item>. The message is a bit cryptic and totally unrelated to that fact, but that is why this is listed as a trap. In general, all subs defined in any part of the hierarchy are going to cause problems; some methods will too. For instance, C<CREATE>, C<take> and C<defined> (which are defined in L<Mu>). In general, multi methods and simple methods will not have any problem, but it might not be a good practice to use them as rule names.
1617
-
1618
-
Also avoid L<phasers|/language/objects#Object_Construction> for rule/token/regex names: C<TWEAK>, C<BUILD>, C<BUILD-ALL> will throw another kind of exception if you do that: C<Cannot find method 'match': no method cache and no .^find_method>, once again only slightly related to what is actually going on.
1618
+
C«item» seems innocuous enough, but it is a L<C<sub> defined in class
1619
+
C<Mu>|/routine/item>. The message is a bit cryptic and totally unrelated to that
1620
+
fact, but that is why this is listed as a trap. In general, all subs defined in
1621
+
any part of the hierarchy are going to cause problems; some methods will too.
1622
+
For instance, C<CREATE>, C<take> and C<defined> (which are defined in L<Mu>). In
1623
+
general, multi methods and simple methods will not have any problem, but it
1624
+
might not be a good practice to use them as rule names.
1625
+
1626
+
Also avoid L<phasers|/language/objects#Object_Construction> for rule/token/regex
1627
+
names: C<TWEAK>, C<BUILD>, C<BUILD-ALL> will throw another kind of exception if
1628
+
you do that: C<Cannot find method 'match': no method cache and no
1629
+
.^find_method>, once again only slightly related to what is actually going on.
0 commit comments