Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #32545] [TODO] remove Perl dependancy on "split"

7 views
Skip to first unread message

Will Coleda

unread,
Nov 22, 2004, 1:41:13 AM11/22/04
to bugs-bi...@rt.perl.org
# New Ticket Created by Will Coleda
# Please include the string: [perl #32545]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32545 >


The split opcode currently uses a PerlArray to house its result. It should use a non-language specific class.

James deBoer

unread,
Dec 8, 2004, 2:33:04 PM12/8/04
to perl6-i...@perl.org, bugs-bi...@rt.perl.org
Attached is a patch that changes the split opcode to use an Array
instead of a PerlArray.

It also updates the documentation to note this.

All the tests still pass, and a grep in the languages/ directory shows
that no language implementations are effected.

- James

split_using_Array.patch

William Coleda

unread,
Dec 8, 2004, 7:23:12 PM12/8/04
to James deBoer, perl6-i...@perl.org, bugs-bi...@netlabs.develooper.com
Thanks, applied!

James deBoer wrote:

> ------------------------------------------------------------------------
>
> ? classes/.array.pmc.swp
> Index: ops/string.ops
> ===================================================================
> RCS file: /cvs/public/parrot/ops/string.ops,v
> retrieving revision 1.28
> diff -u -r1.28 string.ops
> --- ops/string.ops 28 Sep 2004 11:26:49 -0000 1.28
> +++ ops/string.ops 6 Dec 2004 19:16:59 -0000
> @@ -561,7 +561,7 @@
>
> =item B<split>(out PMC, in STR, in STR)
>
> -Create a new PerlArray PMC $1 by splitting the string $3 with
> +Create a new Array PMC $1 by splitting the string $3 with
> regexp $2. Currently implemented only for the empty string $2.
>
> =cut
> @@ -589,7 +589,7 @@
> }
>
> op split(out PMC, in STR, in STR) :base_core {
> - PMC *res = $1 = pmc_new(interpreter, enum_class_PerlArray);
> + PMC *res = $1 = pmc_new(interpreter, enum_class_Array);
> STRING *r = $2;
> STRING *s = $3;
> int slen = string_length(interpreter, s);
> @@ -599,6 +599,7 @@
> goto NEXT();
> if (string_length(interpreter, r))
> internal_exception(1, "Unimplemented split by regex");
> + VTABLE_set_integer_native(interpreter, res, slen);
> for (i = 0; i < slen; ++i) {
> STRING *p = string_substr(interpreter, s, i, 1, NULL, 0);
> /* TODO first set empty string, then replace */

0 new messages