Permalink
Browse files

Straighten out .tc/.tclc and tc()/tclc()

  • Loading branch information...
1 parent bab03d3 commit 484f0898609305f2327086ece67a3569636f7fe1 @lizmat lizmat committed Sep 3, 2013
Showing with 6 additions and 26 deletions.
  1. +6 −10 src/core/Cool.pm
  2. +0 −16 src/core/Str.pm
View
@@ -96,17 +96,15 @@ my class Cool { # declared in BOOTSTRAP
}
method tc() {
- self.Str.tc;
+ my $u := nqp::unbox_s(self.Str);
+ nqp::p6box_s(nqp::uc(nqp::substr($u,0,1)) ~ nqp::substr($u,1));
}
method tclc() {
- self.Str.tclc;
+ nqp::p6box_s(nqp::tclc(nqp::unbox_s(self.Str)))
}
- method ucfirst() is DEPRECATED {
- my $self-str = self.Str;
- $self-str eq '' ?? '' !! $self-str.substr(0, 1).uc ~ $self-str.substr(1)
- }
+ method ucfirst() is DEPRECATED { self.tc }
method capitalize() is DEPRECATED { self.Stringy.capitalize }
method wordcase() { self.Str.wordcase }
@@ -230,8 +228,9 @@ sub lc(Cool $s) { $s.lc }
sub ord(Cool $s) { $s.ord }
sub substr(Cool $s,$pos,$chars?) { $s.substr($pos,$chars) }
sub uc(Cool $s) { $s.uc }
-
sub ucfirst(Cool $s) is DEPRECATED { $s.ucfirst }
+sub tc(Cool $s) { $s.tc }
+sub tclc(Cool $s) { $s.tclc }
proto sub rindex($, $, $?) is pure { * };
multi sub rindex(Cool $s, Cool $needle, Cool $pos) { $s.rindex($needle, $pos) };
@@ -251,9 +250,6 @@ proto sub wordcase($) is pure { * }
multi sub wordcase(Str:D $x) {$x.wordcase }
multi sub wordcase(Cool $x) {$x.Str.wordcase }
-proto sub tclc($) is pure { * }
-multi sub tclc(Cool $x) { tclc $x.Str }
-
sub sprintf(Cool $format, *@args) {
unless $sprintfHandlerInitialized {
nqp::sprintfaddargumenthandler(SprintfHandler.new);
View
@@ -991,14 +991,6 @@ my class Str does Stringy { # declared in BOOTSTRAP
nqp::p6box_i(nqp::chars(nqp::unbox_s(self)))
}
- method tc(Str:D:) returns Str:D {
- my $u := nqp::unbox_s(self);
- nqp::p6box_s(nqp::tclc(nqp::substr($u,0,1)) ~ nqp::substr($u,1));
- }
- method tclc(Str:D:) returns Str:D {
- nqp::p6box_s(nqp::tclc(nqp::unbox_s(self)))
- }
-
method path(Str:D:) returns IO::Path:D {
IO::Path.new(self)
}
@@ -1156,11 +1148,3 @@ sub substr-rw($s is rw, $from = 0, $chars = $s.chars - $from) {
}
);
}
-
-multi sub tc(Str:D $s) returns Str:D {
- my $u := nqp::unbox_s($s);
- nqp::p6box_s(nqp::tclc(nqp::substr($u,0,1)) ~ nqp::substr($u,1));
-}
-multi sub tclc(Str:D $s) returns Str:D {
- nqp::p6box_s(nqp::tclc(nqp::unbox_s($s)));
-}

0 comments on commit 484f089

Please sign in to comment.