Skip to content

Commit f8fc48f

Browse files
committed
problems with grammar attributes and a solution
One could say one cannot _declare_ grammar attributes but rakudo barks only when we use them. For more context: https://rt.perl.org/Ticket/Display.html?id=122253 http://irclog.perlgeek.de/perl6/2015-03-11#i_10262331 rakudo/rakudo@858ac4e
1 parent 8ee967d commit f8fc48f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

S12-objects.pod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ handled with lexical scoping in Perl 6. The fact that importation
205205
is lexical by default also means that any names your class imports
206206
are also private by default.
207207

208+
In grammars, one cannot use grammar attributes so one can call
209+
a grammar rule from an unrelated grammar.
210+
One can emulate that behavior with lexically scoped grammars created
211+
within a closure. The lexical variables captured by the closure can then
212+
be used where grammar attributes would be.
213+
208214
=head2 Class composition
209215

210216
Class declarations (in particular, role composition) are strictly

0 commit comments

Comments
 (0)