Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Str.chop #349

Closed
p6rt opened this issue Sep 30, 2008 · 5 comments
Closed

Refactor Str.chop #349

p6rt opened this issue Sep 30, 2008 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 30, 2008

Migrated from rt.perl.org#59480 (status was 'resolved')

Searchable as RT59480$

@p6rt
Copy link
Author

p6rt commented Sep 30, 2008

From @bacek

Hello.

There is suggestion from Pm for Str.chop

+.sub 'chop' :method
+ len = length tmps
+ if len == 0 goto done
+ dec len
+ substr tmps,tmps, 0, len
...

PIR has a C<chop> opcode, perhaps we should use it?

--
Bacek

@p6rt
Copy link
Author

p6rt commented Oct 1, 2008

From @azawawi

Hi bacek,

Here is the patch for it.

To test it, please use​:
./perl6 t/spec/S29-str/chop.rakudo

Index​: src/builtins/any-str.pir

--- src/builtins/any-str.pir (revision 31539)
+++ src/builtins/any-str.pir (working copy)
@​@​ -98,16 +98,10 @​@​
.sub 'chop' :method :multi(_)
  .local string tmps
  .local pmc retv
- .local int len

- retv = new 'Perl6Str'
  tmps = self
-
- len = length tmps
- if len == 0 goto done
- dec len
- substr tmps,tmps, 0, len
- done​:
+ chopn tmps, 1
+ retv = new 'Perl6Str'
  retv = tmps
  .return(retv)
.end

@p6rt
Copy link
Author

p6rt commented Oct 1, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 1, 2008

From @moritz

On Wed Oct 01 03​:55​:19 2008, ahmadz wrote​:

Here is the patch for it.

Thanks, applied as r31541.

To test it, please use​:
./perl6 t/spec/S29-str/chop.rakudo

I prefer 'make fulltest', because sometimes changes have unexpected
non-local effects.

(and fulltest also runs codetest, which I tend to forget otherwise).

@p6rt
Copy link
Author

p6rt commented Oct 1, 2008

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Oct 1, 2008
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant