<masak> moritz: is there something about `eager` that's still NYI that
makes Rakudo -n not run code ASAP?
<masak> or are you saying "it's a feature, not a bug"?
<masak> because it seems to me we keep running into situations where the
bit of spec that says "&map (or gather, rather) is allowed to buffer a
few elements ahead" breaks reasonable expectations.
<jnthn> masak: We already know map is too eager.
<jnthn> masak: It's on Pm's todo list already.
<moritz> yes, there's a submitted bug for that
<moritz> and it's the .munch($argc * $count) thing that was discussed
yesterday or so
<jnthn> Right.
<masak> oh, ok.
<masak> but $*IN.ins is almost-but-not-quite orthogonal, I guess.
<moritz> no
<moritz> .lines calls .get internally
<moritz> so on a strictly lazy iteration, .ins is always in sync with
the iterator
<masak> i.e. I'll merge this ticket with the one that already talks
about map being too eager?
<moritz> +1
* masak makes it so
<colomon> maybe I'm being dense, but I don't see how .ins can make sense
with .lines.
<colomon> unless you're looking for the total number of lines
<masak> .lines reads all lines by default. it also takes an argument, in
which case it doesn't.
<masak> .ins should work like $. , IMHO.
<colomon> masak: but it doesn't really make sense in a possibly lazy
context.
<moritz> r: sub l { gather while !$*IN.eof { take get } }; my $x = l()
[2]; say $*IN.ins
<p6eval> rakudo e75663: OUTPUT«0»
<moritz> r: sub l { gather while !$*IN.eof { take $*IN.get } }; my $x =
l()[2]; say $*IN.ins
<p6eval> rakudo e75663: OUTPUT«3»
<moritz> OH
<moritz> it's $*ARGS vs. $*IN
<colomon> who'd win?
* moritz
<masak> if $*ARGS.ins works like I want, I'll happily let moritz win ;)
<moritz> erm, ARGFILES, sorry
<masak> woddeva.
<moritz> but it doesn't seem to work either
<masak> right. for the above reasons.
<moritz> I'm not convinced
<moritz> because it always says 0
<moritz> but it really should say the last line number all over, no?
<moritz> r: class A { has $.x }; class B is A { has $.x; method set() {
$!x = 5 } }; given B.new { .set; say .x }
<p6eval> rakudo e75663: OUTPUT«5»
<moritz> the problem is that IO::ArgFiles inherits from IO
<moritz> and has it own $!ins
<moritz> but not its own accessor
<moritz> IO::ArgFiles.ins returns $!ins from class IO, which is still 0
<masak> huh.
<moritz> masak: fun, eh?
<masak> sounds like something's askew somewhere...
<moritz> but a single-character fix
<masak> \o/
<dalek> rakudo/qbootstrap: 51f1b93 | moritz++ | src/core/IO/ArgFiles.pm:
<dalek> rakudo/qbootstrap: fix IO::ArgFiles.ins
<dalek> rakudo/qbootstrap: review:
https://github.com/rakudo/rakudo/commit/51f1b934ac
<moritz> now it returns the number of the last line all over, as I
expected :-)
<moritz> r: for lines() { print $*ARGFILES.get }
<p6eval> rakudo e75663: OUTPUT«End of argfiles reached [...]
<moritz> r: for lines() { print $*ARGFILES.ins }
<p6eval> rakudo e75663: OUTPUT«00000000000000000000000»
* masak adds all this to le ticket