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

slicing a string with inifinite ranges gives LTA error message #2695

Closed
p6rt opened this issue Apr 3, 2012 · 9 comments
Closed

slicing a string with inifinite ranges gives LTA error message #2695

p6rt opened this issue Apr 3, 2012 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Apr 3, 2012

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

Searchable as RT112216$

@p6rt
Copy link
Author

p6rt commented Apr 3, 2012

From @moritz

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
  class 'Str'␤ in method postcircumfix​:<[ ]> at
  src/gen/CORE.setting​:1147␤ in block <anon> at
  /tmp/1ZiRf7yMZW​:1␤␤»

@p6rt
Copy link
Author

p6rt commented Apr 3, 2012

From @pmichaud

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Apr 3, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 3, 2012

From @moritz

On 04/03/2012 06​:44 PM, Patrick R. Michaud via RT wrote​:

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Now we have "foo"[2] fail(), but "foo"[2..*] returns the empty Parcel.
Is that the intended behavior?

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Apr 3, 2012

From @pmichaud

On Tue, Apr 03, 2012 at 09​:22​:11PM +0200, Moritz Lenz wrote​:

On 04/03/2012 06​:44 PM, Patrick R. Michaud via RT wrote​:

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Now we have "foo"[2] fail(), but "foo"[2..*] returns the empty Parcel.
Is that the intended behavior?

Since "foo" acts like a list of one element, I suspect that .[2..*]
should act the same as when used on an array of one element, which
results in an empty Parcel​:

  my @​array = "foo";
  say @​array[2..*].elems; # 0
  say "foo"[2..*].elems; # 0

If that's wrong, we need better spectests to get the correct
behavior.

Pm

@p6rt
Copy link
Author

p6rt commented Apr 4, 2012

From @moritz

On 04/03/2012 11​:16 PM, Patrick R. Michaud wrote​:

On Tue, Apr 03, 2012 at 09​:22​:11PM +0200, Moritz Lenz wrote​:

On 04/03/2012 06​:44 PM, Patrick R. Michaud via RT wrote​:

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Now we have "foo"[2] fail(), but "foo"[2..*] returns the empty Parcel.
Is that the intended behavior?

Since "foo" acts like a list of one element,

My point is that it currently doesn't really.

Compare​:

say "foo".list.[2] # Nil

with

say "foo".[2] # Index out of range. Is​: 2, should be in 0..0

which is why I'm complaining about inconsistencies.

I suspect that .[2..*]
should act the same as when used on an array of one element, which
results in an empty Parcel​:

my @&#8203;array = "foo";
say @&#8203;array\[2\.\.\*\]\.elems;   \# 0
say "foo"\[2\.\.\*\]\.elems;   \# 0

If that's wrong, we need better spectests to get the correct
behavior.

No, first we need agreement on what the right behavior is. Thinking
about spectests before we're positive on the right behavior is taking
things out of order.

@p6rt
Copy link
Author

p6rt commented Jan 22, 2014

From @coke

On Tue Apr 03 22​:38​:13 2012, moritz wrote​:

On 04/03/2012 11​:16 PM, Patrick R. Michaud wrote​:

On Tue, Apr 03, 2012 at 09​:22​:11PM +0200, Moritz Lenz wrote​:

On 04/03/2012 06​:44 PM, Patrick R. Michaud via RT wrote​:

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Now we have "foo"[2] fail(), but "foo"[2..*] returns the empty Parcel.
Is that the intended behavior?

Since "foo" acts like a list of one element,

My point is that it currently doesn't really.

Compare​:

say "foo".list.[2] # Nil

with

say "foo".[2] # Index out of range. Is​: 2, should be in 0..0

which is why I'm complaining about inconsistencies.

I suspect that .[2..*]
should act the same as when used on an array of one element, which
results in an empty Parcel​:

my @&#8203;array = "foo";
say @&#8203;array\[2\.\.\*\]\.elems;   \# 0
say "foo"\[2\.\.\*\]\.elems;   \# 0

If that's wrong, we need better spectests to get the correct
behavior.

No, first we need agreement on what the right behavior is. Thinking
about spectests before we're positive on the right behavior is taking
things out of order.

Looks like there is already a spec test in S02-types/lists.t

Removing testneeded tag, but it sounds like we need to answer the question about what the right behavior is before we can keep that test and close the ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 12, 2016

From @coke

On Tue Jan 21 17​:15​:14 2014, coke wrote​:

On Tue Apr 03 22​:38​:13 2012, moritz wrote​:

On 04/03/2012 11​:16 PM, Patrick R. Michaud wrote​:

On Tue, Apr 03, 2012 at 09​:22​:11PM +0200, Moritz Lenz wrote​:

On 04/03/2012 06​:44 PM, Patrick R. Michaud via RT wrote​:

On Tue Apr 03 01​:24​:47 2012, moritz wrote​:

10​:23 < timotimo> r​: say "foo"[1..*]
10​:23 <+p6eval> rakudo 8ead1e​: OUTPUT«Method 'gimme' not found
for
invocant of
class 'Str'␤ in method postcircumfix​:<[ ]> at
src/gen/CORE.setting​:1147␤ in block <anon> at
/tmp/1ZiRf7yMZW​:1␤␤»

Now fixed in 1bbf9eb, needs spectests to close ticket.

Now we have "foo"[2] fail(), but "foo"[2..*] returns the empty
Parcel.
Is that the intended behavior?

Since "foo" acts like a list of one element,

My point is that it currently doesn't really.

Compare​:

say "foo".list.[2] # Nil

with

say "foo".[2] # Index out of range. Is​: 2, should be in 0..0

which is why I'm complaining about inconsistencies.

I suspect that .[2..*]
should act the same as when used on an array of one element, which
results in an empty Parcel​:

my @​array = "foo";
say @​array[2..*].elems; # 0
say "foo"[2..*].elems; # 0

If that's wrong, we need better spectests to get the correct
behavior.

No, first we need agreement on what the right behavior is. Thinking
about spectests before we're positive on the right behavior is taking
things out of order.

Looks like there is already a spec test in S02-types/lists.t

Removing testneeded tag, but it sounds like we need to answer the
question about what the right behavior is before we can keep that test
and close the ticket.

16​:56 < TimToady> [Coke]​: I guess in the absence of strong arguments to the
  contrary, I'm okay with the current behavior of #​112216

With that, closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 12, 2016

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

@p6rt p6rt closed this as completed Jan 12, 2016
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