Larry says that
sub foo { ... }
is equivalent to
sub foo will do {...}
But then goes on to give the grammar for subroutine definitions as:
rule lexicalsub :w {
<lexscope> <type>?
<subintro> <subname> <psignature>?
<trait>*
<block>
}
rule packagesub :w {
<subintro> <subname> <psignature>?
<trait>*
<block>
}
rule anonsub :w {
<subintro> <psignature>?
<trait>*
<block>
}
which won't match C<< sub foo will do { ... } >>. I presume this is
another of those cases where the rules should be:
rule lexicalsub :w {
<lexscope> <type>?
<subintro> <subname> <psignature>?
<trait>*
<block>?
}
rule packagesub :w {
<subintro> <subname> <psignature>?
<trait>*
<block>?
}
rule anonsub :w {
<subintro> <psignature>?
<trait>*
<block>?
}
and rely on semantic analysis to catch the error and throw a sensible
exception?
--
Piers