Moved the split function from Str.pir to any-str.pm and removed the
Perl6Str coercion.
Index: src/builtins/any-str.pir
===================================================================
--- src/builtins/any-str.pir (revision 31254)
+++ src/builtins/any-str.pir (working copy)
@@ -172,6 +172,31 @@
.return ($P0)
.end
+=item split
+
+ our List multi Str::split ( Str $delimiter , Str $input = $+_, Int $limit = inf )
+ our List multi Str::split ( Rule $delimiter = /\s+/, Str $input = $+_, Int $limit = inf )
+ our List multi Str::split ( Str $input : Str $delimiter , Int $limit = inf )
+ our List multi Str::split ( Str $input : Rule $delimiter , Int $limit = inf )
+
+String delimiters must not be treated as rules but as constants. The
+default is no longer S<' '> since that would be interpreted as a constant.
+P5's C<< split('S< >') >> will translate to C<.words> or some such. Null trailing fields
+are no longer trimmed by default. We might add some kind of :trim flag or
+introduce a trimlist function of some sort.
+
+B<Note:> partial implementation only
+
+=cut
+
+.namespace[]
+.sub 'split' :multi(_,_)
+ .param pmc sep
+ .param pmc target
+ .return target.'split'(sep)
+.end
+
+.namespace['Any']
.sub 'split' :method :multi('String')
.param string delim
.local string objst
@@ -202,12 +227,6 @@
.return(retv)
.end
-=item split(/PATTERN/)
-
-Splits something on a regular expresion
-
-=cut
-
.sub 'split' :method :multi(_, 'Sub')
.param pmc regex
.local pmc match
Index: src/classes/Str.pir
===================================================================
--- src/classes/Str.pir (revision 31254)
+++ src/classes/Str.pir (working copy)
@@ -318,39 +318,6 @@
.return s.'capitalize'()
.end
-
-=item split
-
- our List multi Str::split ( Str $delimiter , Str $input = $+_, Int $limit = inf )
- our List multi Str::split ( Rule $delimiter = /\s+/, Str $input = $+_, Int $limit = inf )
- our List multi Str::split ( Str $input : Str $delimiter , Int $limit = inf )
- our List multi Str::split ( Str $input : Rule $delimiter , Int $limit = inf )
-
-String delimiters must not be treated as rules but as constants. The
-default is no longer S<' '> since that would be interpreted as a constant.
-P5's C<< split('S< >') >> will translate to C<.words> or some such. Null trailing fields
-are no longer trimmed by default. We might add some kind of :trim flag or
-introduce a trimlist function of some sort.
-
-B<Note:> partial implementation only
-
-=cut
-
-.sub 'split'
- .param string sep
- .param string target
- .local pmc a, b
-
- a = new 'Perl6Str'
- b = new 'Perl6Str'
-
- a = target
- b = sep
-
- .return a.'split'(b)
-.end
-
-
=item chop
our Str method Str::chop ( Str $string: )