Skip to content

Commit b06e890

Browse files
committed
document two error classes related to "augment"
1 parent cfcc2b9 commit b06e890

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

lib/X/Syntax/Augment/Role.pod

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=begin pod
2+
3+
=TITLE class X::Syntax::Augment::Role
4+
5+
class X::Syntax::Augment::Role does X::Syntax { }
6+
7+
Compile time error thrown when trying to agument a role.
8+
9+
For example
10+
11+
use MONKEY_TYPING;
12+
augment role Positional { }
13+
14+
dies with
15+
16+
===SORRY!===
17+
Cannot augment role Positional, since roles are immutable
18+
19+
=head1 Methods
20+
21+
=head2 role-name
22+
23+
method role-name() returns Str:D
24+
25+
Returns the name of the role that was attempted to augment.
26+
27+
=end pod
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=begin pod
2+
3+
=TITLE class X::Syntax::Augment::WithoutMonkeyTyping
4+
5+
class X::Syntax::Augment::WithoutMonkeyTyping does X::Syntax { }
6+
7+
Compile time error thrown when C<augment> is used without C<use MONKEY_TYPING>.
8+
9+
Since C<augment> is considered a rather unsafe and impolate action, you have
10+
to pre-declare your intent with the C<use MONKEY_TYPING;> pragma.
11+
12+
If you don't do that, for example
13+
14+
augment class Int { };
15+
16+
you get the error
17+
18+
===SORRY!===
19+
augment not allowed without 'use MONKEY_TYPING'
20+
21+
=end pod

0 commit comments

Comments
 (0)