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

Return the empty list on non-positive LIMIT #357

Closed
p6rt opened this issue Oct 6, 2008 · 5 comments
Closed

Return the empty list on non-positive LIMIT #357

p6rt opened this issue Oct 6, 2008 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 6, 2008

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

Searchable as RT59642$

@p6rt
Copy link
Author

p6rt commented Oct 6, 2008

From cdavaz@gmail.com

Here is a small patch to make split return the empty list on
non-positive limit arguments instead of returning the string split
entirely. Moritz, I think it was you who suggested that negative
arguments be 'rejected by the signature' but I am not sure how to do
this in PIR.

@p6rt
Copy link
Author

p6rt commented Oct 6, 2008

From cdavaz@gmail.com

any-str.pir.diff
Index: src/builtins/any-str.pir
===================================================================
--- src/builtins/any-str.pir	(revision 31687)
+++ src/builtins/any-str.pir	(working copy)
@@ -411,8 +411,7 @@
 
     # per Perl 5's negative LIMIT behavior
     unless has_count goto positive_count
-    unless count < 1 goto positive_count
-    has_count = 0
+    if count < 1 goto done
 
   positive_count:
     match = regex($S0)

@p6rt
Copy link
Author

p6rt commented Oct 6, 2008

From @moritz

On Sun Oct 05 20​:43​:05 2008, cdavaz wrote​:

Here is a small patch to make split return the empty list on
non-positive limit arguments instead of returning the string split
entirely.

Thanks, applied as r31714.

Moritz, I think it was you who suggested that negative
arguments be 'rejected by the signature' but I am not sure how to do
this in PIR.

I don't think it's possible in PIR, so we'll wait for the time when
builtins can be written in Perl 6 (and maybe we have feedback from p6l
at that time too).

Moritz

@p6rt
Copy link
Author

p6rt commented Oct 6, 2008

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

@p6rt
Copy link
Author

p6rt commented Oct 6, 2008

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

@p6rt p6rt closed this as completed Oct 6, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant