Skip to content

Commit 20fb6ce

Browse files
committed
is DEPRECATED on attributes works now
1 parent f6df30a commit 20fb6ce

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

doc/Type/Attribute.pod6

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,20 @@ error.
6868
6969
Marks an attribute as deprecated, optionally with a message what to use instead.
7070
71-
TODO: Add example when it's implemented in Rakudo.
71+
class C {
72+
has $.foo is DEPRECATED("'bar'");
73+
}
74+
my $c = C.new( foo => 42 ); # doesn't trigger with initialization (yet)
75+
say $c.foo; # does trigger on usage
76+
77+
B<After> the program is finished, this will show something like this on
78+
STDERR:
79+
80+
# Saw 1 occurrence of deprecated code.
81+
# =====================================
82+
# Method foo (from C) seen at:
83+
# script.pl6, line 5
84+
# Please use 'bar' instead.
7285
7386
=head1 Methods
7487

0 commit comments

Comments
 (0)