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

Ranges that start with an empty string produce lots of empty strings (‘’…‘WAT’) #5322

Closed
p6rt opened this issue May 16, 2016 · 5 comments
Labels
RFC Request For Comments

Comments

@p6rt
Copy link

p6rt commented May 16, 2016

Migrated from rt.perl.org#128162 (status was 'rejected')

Searchable as RT128162$

@p6rt
Copy link
Author

p6rt commented May 16, 2016

From @AlexDaniel

Code​:
dd (��..�WAT�)[^20]

Result​:
("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")

I don't know what would be the right behavior, but an infinite list of empty strings is probably the worst option out of all. When trying to produce a range by using two strings, I expect either nothing, or one empty string, or some weird string sequence, or a very large list of different strings. The only thing that I am not expecting is an infinite list.

@p6rt
Copy link
Author

p6rt commented May 18, 2016

From @coke

On Mon May 16 16​:55​:40 2016, alex.jakimenko@​gmail.com wrote​:

Code​:
dd (��..�WAT�)[^20]

Result​:
("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "")

I don't know what would be the right behavior, but an infinite list of
empty strings is probably the worst option out of all. When trying to
produce a range by using two strings, I expect either nothing, or one
empty string, or some weird string sequence, or a very large list of
different strings. The only thing that I am not expecting is an
infinite list.

I think your expectations are incorrect, and this is the right behavior.

You've asked for a range starting at the empty string, and then continuing using the autoincrement until the string 'WAT' is generated. But the autoincrement of the empty string is... the empty string, which seems correct.

Rejecting ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 18, 2016

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

@p6rt p6rt closed this as completed May 18, 2016
@p6rt
Copy link
Author

p6rt commented May 18, 2016

@coke - Status changed from 'open' to 'rejected'

@p6rt
Copy link
Author

p6rt commented May 18, 2016

From @AlexDaniel

On Wed May 18 12​:54​:12 2016, coke wrote​:

On Mon May 16 16​:55​:40 2016, alex.jakimenko@​gmail.com wrote​:

Code​:
dd (��..�WAT�)[^20]

Result​:
("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "")

I don't know what would be the right behavior, but an infinite list
of
empty strings is probably the worst option out of all. When trying to
produce a range by using two strings, I expect either nothing, or one
empty string, or some weird string sequence, or a very large list of
different strings. The only thing that I am not expecting is an
infinite list.

I think your expectations are incorrect, and this is the right
behavior.

You've asked for a range starting at the empty string, and then
continuing using the autoincrement until the string 'WAT' is
generated. But the autoincrement of the empty string is... the empty
string, which seems correct.

Rejecting ticket.

Although I don't agree with your point, I do agree that this ticket should be closed. For a different reason. Here​:

Code​:
say (�#�..�WAT�)[^20]

Result​:
(# # # # # # # # # # # # # # # # # # # #)

So an empty string is not the only reason for pointless infinite lists. However, see this​:

Code​:
say (�a�..�WAT�)[^20]

Result​:
(Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil)

So the autoincrement of the empty string is the empty string, but the autoincrement of �a� is nothing. Great.

Well no, of course, it's not the case, because it depends on your end point� But the whole thing is so unpredictable that I don't even know where to start.

@p6rt p6rt added the RFC Request For Comments label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

1 participant