pugscode.org/ | nopaste: sial.org/pbot/perl6 | pugs: [~] <m oo se> (or rakudo:, kp6:, elf: etc.) (or perl6: for all) | irclog: irc.pugscode.org/
Set by Tene on 29 July 2008.
TimToady void is considered a scalar context, which is not lazy 00:00
ruoso my $a = map { } behaves differently then my @a = map { }
TimToady it only behaves differently if you depend on side effects 00:01
which is naughty :)
ruoso and how am I supposed to know if I depend on side effects?
speckbot r14578 | larry++ | added Rat type to list of immutables, mbiggar++ 00:02
TimToady because either you wrote the code you're calling, or it's documenting in the API 00:03
a function that returns Void is a pretty good clue that it has side effects too :)
ruoso I didn't mean myself in the "I", but the interpreter... 00:05
pugs_svn r22092 | ruoso++ | [smop] adding postfix:<++> to native int 00:06
ruoso how is it going to decide when something in the map block has side effects?
TimToady some of it could be via declaration, and some of it could be by propagating that info upwards into the linkage info 00:09
it's not possible to decide completely, of course 00:10
ruoso you know that there isn't a way to have that in any reliable way, don't you...
TimToady for "Useless use" warnings 95% is good enough
it's mostly a matter of training people to think about it 00:11
ruoso would rather promote laziness on everything
although "void == eager" is acceptable 00:12
TimToady well, algol tried call-by-name and found it wanting...
I think lazy scalars would be the same mistake
it's enough to be able to treat a lazy object as a scalar when you want one 00:13
I think lazy scalars are a lot more confusing to mortals than lazy lists are 00:14
and perl already has the fundamental scalar/list distinction, so it maps fairly naturally, most of the time 00:15
ruoso the point is that lists can be stored in variables with the '$' sigil with no loss
TimToady and where it doesn't, we force it. :)
ruoso and we don't even need the "de-referencing" anymore..
my feeling is that the sigil lost a lot of its power in p6... and having that kind of decision attached to it seems awkward... 00:16
the scalar/list distinction is much less "fundamental" in p6 00:17
we can easily have something that behaves as scalar, list and hash... 00:18
at the same time
we even take advantage on that for some built-in types (Capture and Match)
TimToady well, the singular/plural distinction is awkward in English too, but I live with it. :) 00:20
ruoso TimToady, are you aware on how I am implementing context propagation in SMOP/ 00:25
?
dduncan question ... is there supposed to be a distinct Float type as there is a distinct Rat type, or does Num really just mean anything a float can represent? 00:27
00:28 s1n left
TimToady dduncan: there is no Float type 00:28
dduncan note that in my mind, floating point is just a syntax for specifying a rational number, if the numbers are radix agnostic and unlimited precision
okay
TimToady ruoso: vaguely, but I can't track every detail...
returning a smart return value has its limits when you have to clone a bunch of closures you're unlikely to use 00:29
(depending on how expensive the clone is, which I'm sure varies from VM to VM) 00:30
ruoso but why would I need to eagerly clone the closures?
00:31 bacek joined
allbery_b I was wheezier than usual all last week; maybe it's something in the air 00:31
whoops
00:31 s1n joined
allbery_b how'd I end up here? 00:31
meppl good night 00:32
TimToady ruoso: I dunno, I didn't write everyone's VM. Maybe they wanted to take pressure off the GC by not leaving a lot of pointers outstanding, or something... 00:34
00:35 meppl left
TimToady or maybe there are favoriable cache characteristics if we batch the examination of the lexical context 00:36
*favorable 00:37
ruoso TimToady, btw.. I do plan to have "forward propagation" of the context... I just wanted to keep that to be implemented as a later optimization... but conceptually, it would be implemented as late method calls requesting specific contexts...
TimToady anyway, there's usually some balance between declarative optimizations and lazy optimizations 00:38
it seems a bit odd to delay declarative optimizations till run time
but if you're thinking the compiler's run time...
anyway, I'm not willing to make the decision on that tradeoff for the implementor 00:39
ruoso TimToady, we could consider the return type as part of the signature for a multi... 00:40
the only thing I'm trying to do, actually, is to keep the invocation as simple as possible... 00:41
TimToady that tends to produce time paradoxes though
ruoso and that's why I'm avoiding "forward propagation of the context" at this time 00:42
so the concept keeps itself simpler
because the runtime will always enforce all contexts
by doing the appropriate method calls
00:44 eternaleye left
ruoso I see "forward propagation" as an optimization because it would require some coordination between the caller and the called code to find out when no coercion is needed... 00:44
TimToady, about time paradoxes... return type in the signature could be used for contexts that could be detected at compile-time... 00:46
and they could also be used by JIT compilers... 00:47
00:47 eternaleye joined
TimToady well, sure, this is conjectured somewhere in S12, but it's another thing that could get in the way of getting 6.0 out, so I'm not inclined to insist on it 00:49
ruoso but anyway... we lost ourselves in the point I was trying to clarify 00:50
if the runtime cannot infer side effects, should it consider my $a = map { } lazy? 00:51
TimToady I don't think so; it knows at compile time that it will be coercing a list into item context, and I think that is eager 00:52
ruoso even if a list in item context simply returns itself... 00:53
pugs: my @a = (1,2,3); my $b = @a; say $b;
p6eval pugs: OUTPUT[1 2 3ā¤]
TimToady it's specced to turn into an array :)
ruoso does that mean that it should rebuild any list into a new array? 00:54
wknight8111 if that's the case, why would we need the @ sigil at all?
if $b = @a, and then $b is an array 00:55
TimToady @$a = map { } stays lazy
lambdabot Maybe you meant: . ? @ bf faq ft id map pl rc v wn
ruoso pugs: my @a = (1,2,3); my $b = @a; say @a.WHICH, $b.WHICH; 00:57
p6eval pugs: OUTPUT[123123ā¤]
ruoso pugs: my @a = (1,2,3); my $b = @a; say @a.WHERE, $b.WHERE;
p6eval pugs: OUTPUT[*** No such method in class Array: "&WHERE"ā¤ at /tmp/oSvShCREjz line 1, column 34-42ā¤]
ruoso so my $b = @a creates a copy ? 00:58
TimToady probably not
since coerction to array would be a noop 00:59
it's certainly possible that coercion to item context stays lazy in this case, and it's void context that is specially eager 01:00
ruoso that looks saner to me...
void being special is interesting because use of a list in void context is a clear symptom of imperative programming... 01:01
TimToady doesn't really bother me if a listish container inside a scalar is lazy
I think I'm fine with that, but consider I'm still rather jet-lagged... :) 01:02
01:04 eternaleye left
ruoso cool... so "for" is simply a "map".... and lists in void context are eager... 01:05
and that's all
it's important to realize that... 01:06
sub foo { for 1..10 { say $_ } }; my $x = foo(); say 'not yet...'; $x; say 'thats it...' 01:07
would print 'not yet' before each of the numbers...
perl6: sub foo { for 1..10 { say $_ } }; my $x = foo(); say 'not yet...'; $x; say 'thats it...' 01:08
p6eval pugs, rakudo 30694: OUTPUT[1ā¤2ā¤3ā¤4ā¤5ā¤6ā¤7ā¤8ā¤9ā¤10ā¤not yet...ā¤thats it...ā¤]
..elf 22092: OUTPUT[Useless use of private variable in void context at (eval 127) line 8.ā¤1ā¤2ā¤3ā¤4ā¤5ā¤6ā¤7ā¤8ā¤9ā¤10ā¤not yet...ā¤thats it...ā¤]
ruoso and that possible return is in the specs... 01:10
and if "for" is simply a "map" and it's lazy... "not yet" would appear first....
speckbot r14579 | larry++ | clarify that statement introducers may not use function syntax, which is 01:13
r14579 | larry++ | reserved for user functions of the same name
TimToady yes, and "eager for" would print them first, and "hyper for" would print them in random order 01:16
ruoso cool 01:17
ruoso sleep & (not that I'm really awake...)
TimToady dinner & 01:18
01:18 ruoso left 01:19 kanru joined 01:20 kanru left 01:22 kanru joined, Limbic_Region joined
s1n moritz_: is the pugs suite being moved with an svn move or are the files being added as dups under the spec folder? 01:23
Limbic_Region I think the former 01:24
salutations all
s1n if they're being copied, is there any indication a file or test has been copied over? 01:25
01:28 wknight8111 left 01:35 ting joined 01:41 Ehtyar left 01:49 ludan joined 01:56 ludan left 02:28 hercynium joined 02:46 Auzon joined
s1n rakudo: $ref = ("foo", "bar"); say $ref.WHAT; 02:54
p6eval rakudo 30694: OUTPUT[Scope not found for PAST::Var '$ref'ā¤current instr.: 'parrot;PCT::HLLCompiler;panic' pc 156 (src/PCT/HLLCompiler.pir:103)ā¤]
s1n rakudo: my $ref = ("foo", "bar"); say $ref.WHAT; 02:55
p6eval rakudo 30694: OUTPUT[Arrayā¤]
03:03 BinGOs_ joined 03:06 BinGOs left 03:25 Limbic_Region left 03:26 BinGOs_ left 03:41 BinGOs joined 03:59 Alias_ joined 04:02 justatheory joined, jiing left, audreyt left, audreyt joined 04:08 jiing joined 04:12 BinGOs left 04:19 frobnitz left 04:24 xuser left 04:25 justatheory left 04:32 Guest70230 left 04:35 Guest70230 joined 04:59 alanhaggai left 05:14 hercynium left 05:16 alester joined 05:20 Psyche^ joined 05:34 penk joined 05:36 Patterner left, Psyche^ is now known as Patterner 06:02 fullermd left 06:05 fullermd joined 06:19 ashizawa joined 06:26 pmurias joined
pmurias TimToady: we always know the context of a subcall? is it possible to use a context stored in a variable something like my $context = get_the_context();use_the_context($context,foo(...))? 06:35
s/we/do we/
06:38 Front_slash joined
moritz_ s1n: moved with 'svn mv' 06:43
06:45 Front_slash left 06:49 alester left 06:54 pmurias left
pugs_svn r22093 | lwall++ | [t] more system, require, does, defer, label cleanup 06:56
06:57 dduncan left 07:02 BinGOs joined 07:10 zamolxes joined 07:17 cosimo joined 07:32 iblechbot joined 08:12 elmex joined 08:24 lambdabot left 08:26 lambdabot joined 08:42 Alias_ left 08:58 meteorjay left 09:02 idemal left, meteorjay joined 09:18 bacek left 09:23 meteorjay left 09:36 meteorjay joined 09:38 masak joined 09:39 scrottie joined 09:44 fullermd left 09:48 masak left
pugs_svn r22094 | moritz++ | [t] 09:57
r22094 | moritz++ | * update TASKS
r22094 | moritz++ | * moved operators/smartmatch.t to spec/
r22095 | moritz++ | [t/spec] fudged not.t for rakudo 10:07
r22096 | moritz++ | [t/spec] smartmatcht.t: removed tests for deprecated features, fudged for 10:19
r22096 | moritz++ | rakudo
r22097 | moritz++ | [t] move operators/brainos.t to spec/ 10:21
moritz_ operators/listquote.t has some freaky syntax 10:28
my $s = join |<< <a x y z>;
why isn't that just 'join |<a x y z>'? 10:30
Juerd What the heck is |<<? :) 10:43
moritz_ it's prefix:<|> prefix_postfix_meta_operator:Ā« << Ā» 10:44
prefix:<|> intpolates arrays and hashes into captures
Juerd What's prefix |?
I see
moritz_ had to run STD.pm to identify that
Juerd Wasn't that * at some point? 10:45
moritz_ dunno, * is Whatever now
Juerd Right 10:46
It used to be nicknamed splat
10:58 sri_work_ joined 11:12 sri_work left 11:17 tessier_ joined, tessier__ left 11:32 masak joined
masak @tell jonathan Welcome back from vacation. I would very much like to discuss #58392 with you when you have the time. 11:33
lambdabot Consider it noted.
11:33 masak left 11:41 zamolxes left, zamolxes joined 12:15 rindolf joined 12:21 Lichtkind joined 12:22 ashizawa left 12:31 ruoso joined 12:54 rakudo_svn left, speckbot left, p6eval left, pugs_svn left, bloonix left 12:57 alanhaggai joined 13:02 p6eval joined
moritz_ pugs: say "test" 13:02
p6eval pugs: OUTPUT[testā¤]
13:04 pugs_svn joined 13:06 rakudo_svn joined
rakudo_svn r28699 | pmichaud++ | [rakudo]: 13:07
r28699 | pmichaud++ | * Add workarounds for argument checking of 0-ary functions (RT#56366).
r28703 | pmichaud++ | [rakudo]:
r28703 | pmichaud++ | * Add .pick methods and functions.
r28703 | pmichaud++ | * Add .elems methods and functions to Any.
r28703 | pmichaud++ | * Resolves RT#56266 and RT#49085.
r28704 | petdance++ | adding some type sanity
r28705 | pmichaud++ | [rakudo]:
13:07 rakudo_svn left
moritz_ sorry, that was old news :/ 13:07
13:08 rakudo_svn joined 13:11 frobnitz joined, speckbot joined
moritz_ ok, after rebooting the server I started p6eval, speckbot, rakudo_svn and pugs_svn again 13:11
anything crucial that I forgot?
13:17 jhorwitz joined 13:35 xinming joined 13:41 xinming_ joined 13:46 penk left 13:48 xinming left 13:54 clintongormley joined 13:55 clintongormley left 13:58 clintongormley joined 13:59 clintongormley left 14:04 kanru left 14:06 kanru joined
moritz_ rakudo: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl 14:35
14:36 nwc10 joined
moritz_ pugs: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl 14:36
nwc10 I realise that I asked this question some months ago, but I fail to remember the answer - where is S3 in svn? 14:37
moritz_ evalbot control restart
[particle]1 what is s3?
oh, S03?
14:37 p6eval left
nwc10 er, yes 14:37
synopsis 3
ah. svn.perl.org/perl6/doc/trunk/design/syn/S06.pod 14:38
[particle]1 svn.perl.org/perl6
lambdabot Title: Revision 14579: /
14:38 [particle]1 is now known as [particle]
nwc10 so is there a svnweb for that? 14:38
to annotate it?
moritz_ you shouldn't
[particle] not that i know of
moritz_ send patches to p6l
14:39 p6eval joined
moritz_ pugs: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl 14:39
p6eval pugs: OUTPUT[*** Odd number of elements found where hash expected: VList [VStr "a",VRef <Array:0xb5e9c541>]ā¤ at /tmp/lITpBp5aY3 line 1, column 1-32ā¤]
moritz_ rakudo: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl
p6eval rakudo 30696: OUTPUT[[1, 2, 3, 4]ā¤]
moritz_ overly eager list flattening 14:40
elf: my %h = (a => [[1, 2], [3, 4]]); my @a = %h<a>; say @a.perl 14:41
p6eval elf 22097: OUTPUT[[[1,2],[3,4]]ā¤]
moritz_ elf++
which prevents rakudo from running rounders.t 14:42
14:46 Auzon left, AzureStone left
nwc10 seems there is soemthing: svn.perl.org/viewvc/perl6/doc/trunk...p;r2=14556 14:46
lambdabot Title: 1 [ 5 perl6 1 ] 1 25 Diff of /doc/trunk/design/syn/S03.pod 30, tinyurl.com/5dggcx
14:51 nwc10 left 14:52 jferrero joined
pugs_svn r22098 | moritz++ | [t/spec] corrected rounders.t; fudged for rakudo (ugly mess) 14:58
r22098 | moritz++ | simplified brainos.t a bit
14:59 rakudo_svn left, rakudo_svn joined
rakudo_svn r23021 | bernhard++ | Set properties for newly added files. 14:59
r23165 | pmichaud++ | [perl6]:
r23165 | pmichaud++ | * Correct location of nqp in ROADMAP document (robwest++)
r23260 | coke++ | [perl6] remove integer type IDs
r23371 | coke++ | [perl6] RT #48024 : use new_p_s
r23464 | pmichaud++ | [perl6]:
r23464 | pmichaud++ | * Merging perl6-devel into trunk. The perl6 compiler still fails quite 15:00
15:00 rakudo_svn left
moritz_ sorry 15:00
bot gone wrong
moritz_ tries again
15:00 rakudo_svn joined
rakudo_svn r30698 | moritz++ | [rakudo] add two files to spectest_regression 15:04
15:15 zamolxes left 15:18 eternaleye joined 15:20 Exodist joined 15:26 kanru left 15:35 tessier_ left, tessier_ joined 15:43 kanru joined 15:54 justatheory joined 15:58 BinGOs_ joined 15:59 BinGOs_ left, BinGOs_ joined, BinGOs left 16:00 BinGOs_ is now known as BinGOs, viklund left 16:07 lisppaste3 left 16:08 lisppaste3 joined 16:11 lisppaste3 left 16:20 cosimo left 16:27 lisppaste3 joined 16:34 hercynium joined 16:38 alanhaggai left
pugs_svn r22099 | moritz++ | [t/spec] moved operators/identity.t to spec/ 17:00
17:06 Jedai joined
pugs_svn r22100 | moritz++ | [t] removed operators/relational.t, which is mostly integrated into 17:06
r22100 | moritz++ | spec/S03-operators/relationial.t. migrated the rest over there
r22101 | moritz++ | [t] simpliefied tests a bit, removed duplicate tests 17:14
r22102 | moritz++ | [t] tests for autoincrementing uninitialized variables 17:17
r22103 | moritz++ | [t] move context_forcers.t to spec/ 17:20
r22104 | moritz++ | [spec] s/_/-/ in file name
r22105 | moritz++ | [t/spec] fudge context-forcers.t for rakudo 17:22
17:27 scrottie left
pugs_svn r22106 | moritz++ | [t] moved operator precedence tests to spec/ 17:29
17:36 armagad joined
pugs_svn r22107 | moritz++ | [t/spec] fudged precedence.t for rakudo (over-eager fudge due to fudge bugs) 17:39
17:45 REPLeffect joined
rakudo_svn r30701 | moritz++ | [rakudo] add two files to spectest_regression 17:51
pugs_svn r22108 | moritz++ | [t] moved scalar binding tests to spec/ 17:53
r22109 | moritz++ | [t/spec] some fudgings 17:58
r22110 | lwall++ | [STD] typo on defer token
18:01 kanru left
pugs_svn r22111 | moritz++ | [t] move junction tests to spec/, make them not rely on the internal ordering 18:11
ruoso just heard about prophet... obra++ clkao++ ;) 18:16
rindolf clkao-- - won't fix svk. 18:18
Or help me with a major svk problem.
moritz_ should I start to give negative karma to everybody who doesn't help with my work on the test suite? 18:19
Khisanth wonders if rindolf is related to BKB
rindolf Khisanth: I'm not BKB. 18:20
moritz_: svk is unusable on my system.
moritz_ rindolf: so is Perl 6 on mine
rindolf moritz_: and I have my homepage there.
moritz_: so what depends on Perl 6 now?
I'm using svk for production.
Khisanth moritz_: yes! perhaps they will reincarnate as one of your minions that will be easier to control :) 18:21
moritz_ rindolf: easy coding and a good release of perl depend on Perl 6
moritz_ is not impressed by the "production" meme
Khisanth: they don't have to be easy to control, just easy to motivate ;) 18:22
Khisanth minions do not require motivation
moritz_ ;)
rindolf moritz_: I have reported the bug a few weeks ago and heard nothing from clkao.
moritz_: and someone reported a similar problem earlier.
moritz_: I asked him that on IRC. 18:23
moritz_: and then I posted it on the svk mailing list.
moritz_ rindolf: well, Perl 6 was announce 8 years ago, and we still have no release
rindolf moritz_: so? It can wait.
Khisanth was it only 8?
rindolf Or it's not that critical for our well-being.
[particle] please take your frustrations out in #bang-head-here
moritz_ can it? then so can your svk bug
rindolf: in case you haven't noticed, you're off-topic here with your rants 18:24
rindolf moritz_: ah.
TimToady in any event, you should not personalize it
rakudo_svn r30708 | moritz++ | [rakudo] add binding tests to spectest_regression 18:25
pugs_svn r22112 | moritz++ | [t] moved hash binding tests to spec/ 18:26
18:28 Chillance joined
pugs_svn r22113 | moritz++ | [t/spec] fudged hash binding tests for rakudo 18:30
r22114 | ruoso++ | [smop] update the "for" test to be a "map" test, and also tests the lazyness of the map return 18:31
r22115 | moritz++ | [t/spec] moved array binding tests to spec/ 18:33
r22116 | ruoso++ | [smop] updating CMakeLists.txt for the new test 18:35
ruoso pugs: my @a = map { say $_ } 1..10; say @a[0]; # no numbers above "1" should be seen 18:37
p6eval pugs: OUTPUT[*** ā¤ Unexpected "1"ā¤ expecting ",", ":" or operatorā¤ at /tmp/lPm0i26xnE line 1, column 24ā¤]
ruoso pugs: my @a = map { say $_ } 1 .. 10; say @a[0]; # no numbers above "1" should be seen
p6eval pugs: OUTPUT[*** ā¤ Unexpected "1"ā¤ expecting ",", ":" or operatorā¤ at /tmp/IUgPrgwobN line 1, column 24ā¤]
ruoso pugs: my @a = map { say $_ } (1, 2, 3, 4); say @a[0]; # no numbers above "1" should be seen
p6eval pugs: OUTPUT[*** ā¤ Unexpected "("ā¤ expecting ",", ":" or operatorā¤ at /tmp/6BsfzgwdMN line 1, column 24ā¤]
ruoso pugs: my @a = map { say $_ }, (1, 2, 3, 4); say @a[0]; # no numbers above "1" should be seen 18:38
p6eval pugs: OUTPUT[1ā¤2ā¤3ā¤4ā¤1ā¤]
moritz_ ruoso: pugs doesn't to lazyness yet 18:39
ruoso hmm...
ok
18:40 jhorwitz left
moritz_ s/to/do 18:40
ruoso wonders what "my @a = map { }; say @a.WHAT" should output 18:43
18:44 zamolxes joined
pugs_svn r22117 | moritz++ | [t/spec] really fudged array binding tests for rakudo 18:45
moritz_ List?
[particle] isn't that map missing a param?
ruoso [particle], yeah yeah... it's just a conceptual exercise... 18:46
not real code ;)
rakudo_svn r30711 | moritz++ | [rakudo] two more binding tests for spectest_regression 18:49
18:56 rindolf left
TimToady pugs: my @a = map { }; say @a.WHAT 18:57
p6eval pugs: OUTPUT[*** Cannot cast from VList [] to Pugs.AST.Types.VCode (VCode)ā¤ at /tmp/Px0RY5FZnM line 1, column 9-16ā¤]
TimToady pugs: my @a = map { }, (); say @a.WHAT
p6eval pugs: OUTPUT[*** Cannot cast from VList [] to Pugs.AST.Types.VCode (VCode)ā¤ at /tmp/XaPKFtdEsj line 1, column 9-20ā¤]
TimToady pugs: my @a = map { 42 }, (); say @a.WHAT
p6eval pugs: OUTPUT[Arrayā¤]
[particle] rakudo: my @a = map { }, (); say @a.WHAT 18:58
p6eval rakudo 30711: OUTPUT[No applicable methods.ā¤ā¤current instr.: '_block11' pc 42 (EVAL_13:15)ā¤]
TimToady pugs: my @a = map { ; }; say @a.WHAT
p6eval pugs: OUTPUT[Arrayā¤]
[particle] rakudo: my @a = map { 42 }, (); say @a.WHAT
p6eval rakudo 30711: OUTPUT[Arrayā¤]
TimToady Array is correct
regardless of how lazy its internal interators may be
now if you'd bound something to @a instead of assigning, you can get a different answer 18:59
ruoso keeps getting back to the "iterator API" issue 19:00
I cannot use @originalarray.elems to figure out the size of the array, because that would force eagerly evaluation...
TimToady well, unless the interators involved know how to calculate their length without evaluation 19:01
ruoso which is not the case for a map, usually
TimToady 1..100 knows how long it is
ruoso or a grep
TimToady correct 19:02
ruoso Ideally... I should have an API that allows unordered arrays...
TimToady but asking for the length is an error of the same sort as asking whether you're at end-of-file, or wanting to write a loop (;;) when you should use for
ruoso TimToady, I'm implementing "for" actually... 19:03
and "for" need to know when the input is over
TimToady it's over when you've exhausted your iterators and they return "I'm exhausted, dear, not tonight" errors 19:04
moritz_ so it thrown an exception when it's exhausted?
ruoso and what if we have a list of failures?
TimToady you're looking for that particular failure
ruoso so that particular failure may never be part of an array 19:05
TimToady something has to be out-of-band sometime
ruoso TimToady, java solves that by using "has_next"
TimToady and maybe the iterator object has some out-of-band way of indicating that it was a hard fail 19:06
has_next is really just "eof" in disguise, which I tend to despise
in general you get cleaner semantics by just trying and failing 19:07
so maybe an interface that returns 0 or 1 elements, and 0 indicates failure 19:08
ruoso considering I don't have an exception mechanism in place... may I start with the out-of-band way?
TimToady that's how a lot of STD works
ruoso hmmm 19:09
that's a cool solution, actually
TimToady ratchet mode always returns 0 or 1 list elements
non-ratchet can return more than 1
ruoso prefix:<=> returns a List... where an empty list means the iterator is exhausted..
but it should be a special list... that returns the first element or failure in scalar context 19:10
[particle] like when dbi's fetchrow_arrayref returns undef, you know you have a problem 19:11
that's not an arrayref with undef inside, so it's not valid data
ruoso yeah...
TimToady but we don't officially have references :) 19:12
[particle] mjd talks about that in HOP
in the iterators chapter
ruoso TimToady, I think that's why [particle] used 'like'
;)
[particle] indeed
TimToady now if he'd just use "and stuff" as well, we could mistake him for a Californian 19:13
lunch & 19:14
ruoso but there's still one thing that doesn't feel right...
=@foo seems to imply that @foo keeps an internal iterator state... 19:15
having the iterator externalized looks more natural to me...
TimToady I suspect = on an array is just a synonym for shift
since that's how an array keeps track of its state 19:16
lunch really &
moritz_ that's what one of the tests also say
(that prefix:<=> invokes .shift)
[particle] ooh, lunch. good idea 19:17
ruoso alright... so prefix:<=> not only iterates, but actually "consumes"
moritz_ that's what you usually want when your iterate over =$handle 19:18
otehrwise you'd have to keep the whole file in memory 19:19
19:21 larsen_ joined
ruoso so... since map receives an array as argument, it's sane to think that it can actually consume the incoming array using shift.... 19:21
which makes me wonder... is Range mutable? 19:22
moritz_ don't think so, but you don't iterate over a Range with prefix:<=>
ruoso pugs: say (1 .. 10).shift; 19:23
p6eval pugs: OUTPUT[*** Can't modify constant item: VUndefā¤ at /tmp/ZnXti9cXtS line 1, column 5-20ā¤]
ruoso pugs: say (1..10).shift;
p6eval pugs: OUTPUT[*** Can't modify constant item: VUndefā¤ at /tmp/nfG9SOt8Co line 1, column 5-18ā¤]
moritz_ I think you can just index a Range with .[]
ruoso moritz_, that brings me to the map problem again
[particle] Range is consumed as you go 19:24
ruoso so... map can "shift" the Range...
[particle] but it remembers it's original parameters
so you can query as to what the ends were
ruoso alright... 19:25
[particle] yes, i believe map can shift Range
ruoso so.... map works by shifting the input array and passing the value to the code in each iteration...
(shifting as many times as needed, according to the code's signature .arity) 19:26
is everyone ok with that? ;) 19:27
moritz_ ruoso: but at least one, even if .arity is 0 ;)
[particle] looks good to me 19:28
ruoso although it's pretty weird to think that map would modify the input array....
19:28 silug left
ruoso pugs: my @a = 1..10; my @b = map { $_ + 1 } @a; my @c = map { $_ + 2 } @a; say @c; 19:28
p6eval pugs: OUTPUT[*** ā¤ Unexpected "@a"ā¤ expecting ",", ":" or operatorā¤ at /tmp/OXhhkGEviO line 1, column 39ā¤]
ruoso pugs: my @a = (1..10); my @b = map { $_ + 1 }, @a; my @c = map { $_ + 2 }, @a; say @c; 19:29
p6eval pugs: OUTPUT[3456789101112ā¤]
19:29 silug joined
moritz_ ruoso: what would you 'map { .say } =$handle' expect to do? not consume the $handle? 19:29
that seems pretty nonsensical as well
ruoso but then you have the explicit "=$handle", which indicates that the input will be consumed
moritz_ well, map { .say } @array is not allowed to destroy @array, I'm pretty sure of that 19:31
ruoso so... map cannot shift...
moritz_ it can shift on its argument list
19:33 dr_df0 joined
ruoso moritz_, that doesn't answer the question on how to make that preserving the laziness of the input array 19:34
dr_df0 moritz_: hi
lambdabot dr_df0: You have 1 new message. '/msg lambdabot @messages' to read it.
moritz_ hi dr_df0 ;)
dr_df0 moritz_: how to read my messages?
moritz_ lambdabot tells you 19:35
'/msg lambdabot @messages' to read it.
ruoso: well, it indexes the array... wihch doesn't help you because you can't know when it's over 19:36
ruoso and we keep getting back to index-based access to the array... 19:37
which makes the use of cursors harder...
maybe map should enforce "Iterator" context which then can be "consumed" by map... 19:38
that might help because each object can return a specialized iterator 19:39
and then the iterator implements prefix:<=>
for instance... the Range Iterator knows where to start and when to stop by looking at the ends of the Range 19:40
an Array Iterator knows that it starts at 0 and end at .elems 19:41
a Map Iterator (the one used when cascading maps and greps) only notices the end when the input iterator returns an empty list from prefix:<=> 19:42
19:47 fullermd joined
ruoso . o O ( bootstrapping a lazy type system is pretty hard ) 19:48
19:56 Auzon joined 20:01 dr_df0 left 20:02 donaldh joined 20:04 donaldh left 20:05 alester joined 20:10 larsen_ left 20:15 donaldh joined 20:35 BinGOs left
TimToady list context doesn't just iterate objects. it constructs a list of iterators, asking each object to return one. an array generates a non-destructing iterator, while a filehandle just returns itself to be destroyed 20:38
I think Range objects are more like arrays in returning a separate destructable iterator, preserving the original 20:39
note that scalar variables never return an iterator, but install their values directly into the resulting list 20:40
commuting &
20:56 ruoso left 21:07 BinGOs joined 21:29 Jedai left
pugs_svn r22118 | moritz++ | [t] moved tests for let and temp to spec/ 21:31
r22119 | moritz++ | [t] move misc operator tests to spec/ 21:37
rakudo_svn r30714 | moritz++ | [rakudo] more operator tests for spectest_regression 21:42
pugs_svn r22120 | moritz++ | [t] move tests for spaceship operator to spec/ 21:45
[particle] moritz++ # impressive test conversion velocity 21:50
moritz_ [particle]: I think we *really* need PIR level coverage analysis 21:52
[particle] yes, we do. it's not easy yet, though. 21:53
moritz_ stuff like RT #58500 would be so much easier to catch
rakudo_svn r30716 | moritz++ | [rakudo] one more test for spectest_regression, and re-arrange alphabetically 21:54
moritz_ we need to decide where to put complexity/regression tests 21:56
[particle] outside t/spec/, likely 21:59
moritz_ that's not good wrt "everything that passes the test suite is Perl 6"
for example that recursion+for bug that masak++ reported the other day... 22:00
I think that's really something that the test suite should catch
and I as a tester don't even know where to put recursion tests
not to talk about bugs that only occur when several features interact, and I can't identify which one is wrong (or maybe they are all wrong?) 22:01
StephenPollei svn.perl.org/perl6/doc/trunk/design/syn/S01.pod Overview maybe? 22:04
22:04 armagad left
[particle] i suggest regression tests live in t/regression/ 22:04
t/spec/ should be reserved for spec coverage 22:05
we can expand the meaning of "official test suite" to include all of t/ once it's been refactored properly
22:06 idemal joined
[particle] also t/integration/ makes sense for complex examples 22:06
moritz_ I think it makes things easier if it lives under spec/ for now 22:07
but we can later moved that away again
StephenPollei I like t/integration better than t/regression for something that is part of "official test suite" not tied to any particulat implementation
22:08 donaldh left
[particle] ok, that's fine. does t/spec/integration/ work? 22:08
moritz_ yes
[particle] there is room under t/spec/ for non-S\d\d directories
moritz_ aye
[particle] in fact, i like that better
that allows implementations to keep their tests under t/ directly if they want 22:09
the only reserved directory name is spec/
moritz_ yes
[particle] bike ride & 22:11
moritz_ sleep &
22:14 Auzon left 22:24 explorer__ joined, explorer__ left 22:57 hercynium left 23:08 Exodist left 23:11 idemal left 23:14 iblechbot left 23:19 tessier_ left 23:24 cathya joined 23:37 Khisanth left 23:41 Khisanth joined 23:46 meppl joined 23:50 jferrero left 23:58 ggoebel left 23:59 cotto_work left