Skip Menu |
Report information
Id: 130638
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: samantham [at] posteo.net
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: Samantha McVey <samantham [...] posteo.net>
Date: Tue, 24 Jan 2017 23:14:42 -0800
To: rakudobug [...] perl.org
Subject: [LTA] X::Seq don't say which Seq the exception occurred on
Download (untitled) / with headers
text/plain 408b
CODE: my Seq $thing = (1,3,4).Seq; $thing.iterator; $thing.iterator STDERR: This Seq has already been iterated, and its values consumed (you might solve this by adding .cache on usages of the Seq, or by assigning the Seq into an array) in block <unit> at <unknown file> line 1 I have had lines that have multiple sequences on that, and it is very difficult to know which Seq it was without a nice error.
Download (untitled) / with headers
text/plain 869b
On Tue, 24 Jan 2017 23:15:32 -0800, samantham@posteo.net wrote: Show quoted text
> CODE: > my Seq $thing = (1,3,4).Seq; $thing.iterator; $thing.iterator > > STDERR: > This Seq has already been iterated, and its values consumed > (you might solve this by adding .cache on usages of the Seq, or > by assigning the Seq into an array) > in block <unit> at <unknown file> line 1 > > I have had lines that have multiple sequences on that, and it is very > difficult to know which Seq it was without a nice error.
What would you suggest we do? The point of the Seq iterator is that it doesn't generally store the old values, so pretty much by definition we *can't* give more details about the contents of the Seq, and we generally don't know which variable it's stored in either. Unless somebody has a good idea on how to improve this, I'd close it as "sadly won't fix". Cheers, Mority
From: Samantha McVey <samantham [...] posteo.net>
To: perl6-bugs-followup [...] perl.org
Date: Wed, 25 Jan 2017 01:47:46 -0800
Subject: Re: [perl #130638] [LTA] X::Seq don't say which Seq the exception occurred on
On Wednesday, 25 January 2017 01.45.59 PST you wrote: Show quoted text
> On Tue, 24 Jan 2017 23:15:32 -0800, samantham@posteo.net wrote:
> > CODE: > > my Seq $thing = (1,3,4).Seq; $thing.iterator; $thing.iterator > > > > STDERR: > > This Seq has already been iterated, and its values consumed > > (you might solve this by adding .cache on usages of the Seq, or > > by assigning the Seq into an array) > > in block <unit> at <unknown file> line 1 > > > > I have had lines that have multiple sequences on that, and it is very > > difficult to know which Seq it was without a nice error.
> > What would you suggest we do? The point of the Seq iterator is that it doesn't generally store the old values, so pretty much by definition we *can't* give more details about the contents of the Seq, and we generally don't know which variable it's stored in either. > > Unless somebody has a good idea on how to improve this, I'd close it as "sadly won't fix". > > Cheers, > Mority > >
I don't want the values of the Seq, I want the name of the variable.
From: Moritz Lenz <moritz [...] faui2k3.org>
Date: Wed, 25 Jan 2017 11:52:41 +0100
To: perl6-compiler [...] perl.org
Subject: Re: [perl #130638] [LTA] X::Seq don't say which Seq the exception occurred on
Download (untitled) / with headers
text/plain 1.3k
On 25.01.2017 10:47, Samantha McVey wrote: Show quoted text
> On Wednesday, 25 January 2017 01.45.59 PST you wrote:
>> On Tue, 24 Jan 2017 23:15:32 -0800, samantham@posteo.net wrote:
>> > CODE: >> > my Seq $thing = (1,3,4).Seq; $thing.iterator; $thing.iterator >> > >> > STDERR: >> > This Seq has already been iterated, and its values consumed >> > (you might solve this by adding .cache on usages of the Seq, or >> > by assigning the Seq into an array) >> > in block <unit> at <unknown file> line 1 >> > >> > I have had lines that have multiple sequences on that, and it is very >> > difficult to know which Seq it was without a nice error.
>> >> What would you suggest we do? The point of the Seq iterator is that it doesn't generally store the old values, so pretty much by definition we *can't* give more details about the contents of the Seq, and we generally don't know which variable it's stored in either. >> >> Unless somebody has a good idea on how to improve this, I'd close it as "sadly won't fix". >> >> Cheers, >> Mority >> >>
> > I don't want the values of the Seq, I want the name of the variable.
Trying to find the name of a variable (if there is one at all) from the object is inherently brittle, and has lead to many false positives in the past (like reporting the name of a parameter from a routine in CORE somewhere). -- Moritz Lenz https://deploybook.com/ -- https://perlgeek.de/ -- https://perl6.org/
Subject: Re: [perl #130638] [LTA] X::Seq don't say which Seq the exception occurred on
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Date: Wed, 25 Jan 2017 12:42:50 +0100
To: "Samantha McVey (via RT)" <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 1.7k
I think this is a basic misunderstanding about what an Iterator is and what a Seq. The basic thing is the Iterator. .Seq is nothing but method Seq() { Seq.new(self.iterator) } In other words, a Seq is just a wrapper around an Iterator. In general, you shouldn’t be asking a Seq for its Iterator. You could argue that is something that is only done internally to make things work(tm). Also, unless you’re writing iterators yourself, you should never even need to know about iterators. So I’m wondering what you’re trying to achieve. If you change the code to: my $thing = (1,3,4); $thing.iterator; $thing.iterator it would just give you two iterators. Each iterating over the whole list. Not sure if that’s what you wanted to do, but that cannot be determined from the code provided. Also, I’m not sure how we can improve the error message: most Seq’s are created inside the core setting. And when the “already consumed” error occurs, it’s going to be hard to find out where that Seq got created. So I would categorize this bug as a DIHWIDT Show quoted text
> On 25 Jan 2017, at 08:15, Samantha McVey (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Samantha McVey > # Please include the string: [perl #130638] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=130638 > > > > CODE: > my Seq $thing = (1,3,4).Seq; $thing.iterator; $thing.iterator > > STDERR: > This Seq has already been iterated, and its values consumed > (you might solve this by adding .cache on usages of the Seq, or > by assigning the Seq into an array) > in block <unit> at <unknown file> line 1 > > I have had lines that have multiple sequences on that, and it is very difficult to know which Seq it was without a nice error.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org