Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix deprecations of $*OS/$*OSVER
Basically:
- expose Obsolete as a proper class
- make sure there are 'say' candidates for Obsolete:D: that do .gist
  • Loading branch information
lizmat committed Jun 17, 2014
1 parent 72b1705 commit de3cecc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/core/Deprecations.pm
@@ -1,6 +1,17 @@

my %DEPRECATIONS; # where we keep our deprecation info

class Obsolete is Str {
has $!name;
has $!value;
has $!instead;

submethod BUILD (:$!name, :$!value, :$!instead) {}

method Str { DEPRECATED( $!instead, :up(2), :what($!name) ); $!value }
method gist { DEPRECATED( $!instead, :up(2), :what($!name) ); $!value }
}

class Deprecation {
has $.file; # file of the code that is deprecated
has $.type; # type of code (sub/method etc.) that is deprecated
Expand Down Expand Up @@ -39,17 +50,6 @@ class Deprecation {
$message;
}

class Obsolete is Str {
has $!name;
has $!value;
has $!instead;

submethod BUILD (:$!name, :$!value, :$!instead) {}

method Str { DEPRECATED( $!instead, :up(3), :what($!name) ); $!value }
method gist { DEPRECATED( $!instead, :up(3), :what($!name) ); $!value }
}

# system variable deprecations
method obsolete (|c) { Obsolete.new(|c) }
}
Expand Down
5 changes: 5 additions & 0 deletions src/core/IO.pm
Expand Up @@ -8,6 +8,11 @@ sub print(|) {
}

proto sub say(|) { * }
multi sub say(Obsolete:D \x) {
my $out := $*OUT;
$out.print(x.gist);
$out.print("\n");
}
multi sub say(Str:D \x) {
my $out := $*OUT;
$out.print(x);
Expand Down
2 changes: 2 additions & 0 deletions src/core/Mu.pm
@@ -1,6 +1,7 @@
my class X::Constructor::Positional { ... }
my class X::Method::NotFound { ... }
my class X::Method::InvalidQualifier { ... }
my class Obsolete { ... }

my class Mu { # declared in BOOTSTRAP
proto method ACCEPTS(|) { * }
Expand Down Expand Up @@ -413,6 +414,7 @@ my class Mu { # declared in BOOTSTRAP
method item(Mu \item:) is rw { item }

proto method say(|) { * }
multi method say(Obsolete:D:) { say(self.gist) }
multi method say() { say(self) }
method print() { print(self) }

Expand Down

0 comments on commit de3cecc

Please sign in to comment.