Camelia, the Perl 6 bug

IRC log for #perl6, 2014-07-28

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 hoverboard joined #perl6
00:01 cognome joined #perl6
00:01 timotimo parse_json is faster, array_set_xx is slower, huh.
00:01 jnthn Curious.
00:01 timotimo but forest fire is faster, so well done! :)
00:03 cognome_ joined #perl6
00:04 timotimo jnthn: did you measure the impact on stage parse? :)
00:08 jnthn Yeah. Faster. :)
00:08 jnthn Stage MAST used to be around the 14.xs mark for me, now it's down to 11.xs
00:08 timotimo no numbers?
00:12 thou joined #perl6
00:13 timotimo going to bed now :)
00:14 jnthn 'night timotimo
00:17 avuserow joined #perl6
00:17 * jnthn sleeps too
00:17 jnthn 'night
00:18 timotimo tomorrow will see a weekly spanning two weeks
00:20 rindolf joined #perl6
00:25 cognome joined #perl6
00:30 dalek tablets: 684fdd1 | (Herbert Breunung)++ | docs/appendix-d-delta.txt:
00:30 dalek tablets: backlink design trends properly
00:30 dalek tablets: review: https://github.com/perl6/tablets/commit/684fdd183f
00:30 dalek roast: df19092 | (David Warring david.warring@gmail.com)++ | integration/99problems-21-to-30.t:
00:30 dalek roast: replace invalid autothreading ~~ with subset (<=)
00:30 dalek roast: review: https://github.com/perl6/roast/commit/df19092e4b
00:31 * dwarring reads better anyway
00:41 BenGoldberg joined #perl6
00:47 atroxaper joined #perl6
00:59 dayangkun joined #perl6
01:04 FROGGS_ joined #perl6
01:10 raiph joined #perl6
01:21 rurban1 joined #perl6
01:22 raiph joined #perl6
01:25 cognome joined #perl6
01:31 raiph .tell timotimo https://gist.github.com/raiph/c1202f874c2477b09d1f irc summary trawl
01:31 yoleaux raiph: I'll pass your message to timotimo.
01:46 klapperl_ joined #perl6
01:51 lizmat joined #perl6
02:01 thou joined #perl6
02:05 lizmat_ joined #perl6
02:12 bowtie joined #perl6
02:20 noganex joined #perl6
02:22 rurban1 joined #perl6
02:22 kst joined #perl6
02:24 rurban2 joined #perl6
02:24 itz joined #perl6
02:25 cognome joined #perl6
02:30 lustlife joined #perl6
02:47 atroxaper joined #perl6
02:56 Akagi201 joined #perl6
03:00 * lizmat_ is spectesting last version, and finds it ~5% slower / using 5% more CPU than before  :-(
03:03 figoe joined #perl6
03:06 rurban1 joined #perl6
03:06 Akagi201 joined #perl6
03:07 figoe joined #perl6
03:14 lizmat Files=907, Tests=31845, 232 wallclock secs ( 9.44 usr  4.31 sys + 1466.85 cusr 181.28 csys = 1661.88 CPU)
03:15 lizmat with MVM_SPESH_DISABLE=1: Files=907, Tests=31951, 221 wallclock secs ( 8.84 usr  3.87 sys + 1421.61 cusr 154.11 csys = 1588.43 CPU)
03:15 lizmat FWIW, the timing with MVM_SPESH_DISABLE=1 are more like the timings I've seen before
03:25 ventica2 joined #perl6
03:25 cognome joined #perl6
03:32 chenryn joined #perl6
03:39 ventica2 m: say $*PID;
03:39 camelia rakudo-moar 319a78: OUTPUT«8067␤»
03:39 ventica2 m: say $PID;
03:39 camelia rakudo-moar 319a78: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/OY0IZgD_dDâ�¤Variable '$PID' is not declaredâ�¤at /tmp/OY0IZgD_dD:1â�¤------> [32msay $PID[33mâ��[31m;[0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»
03:40 lizmat ventica2: is there something here you didn't expect ?
03:40 ventica2 no
03:40 ventica2 but not grokkin the $* twigil generally
03:43 ventica2 m: say $( 1 & 2 & 3 );
03:43 camelia rakudo-moar 319a78: OUTPUT«all(1, 2, 3)␤»
03:49 dayangkun joined #perl6
03:49 thou joined #perl6
03:50 rurban1 joined #perl6
03:50 ventica2 say $( 1, 2, 3, );
03:50 ventica2 m: say $( 1, 2, 3, ); #oops
03:50 camelia rakudo-moar 319a78: OUTPUT«1 2 3␤»
03:51 ventica2 ok now that I didn't expect
03:51 ventica2 should it coerce down to a scalar value?
03:51 ventica2 shouldn't*
03:55 lue r: say (1,2,3).perl; say $(1,2,3).perl;
03:55 camelia rakudo-{parrot,jvm,moar} 319a78: OUTPUT«(1, 2, 3)␤$(1, 2, 3)␤»
03:56 lue ventica2: it is a scalar, just in the programming sense of "one object" (in this case, one Parcel), and not the math sense of "one value"
03:56 ventica2 i'm trying to use $() to say "I gave you an array, but I want a scalar. Pick one and DWIM."
03:56 ventica2 and I mean scalar in the P5 sense
03:56 lue ventica2: if you want any one of them, then you want  @list.pick or @list.roll  :)
03:56 ventica2 surely P6 distinguishes between a scalar value and other kinds of "single" things
03:56 ventica2 hrm
03:56 lue r: say (1,2,3).roll(5)
03:56 ventica2 not grokking the overall idea then
03:56 camelia rakudo-moar 319a78: OUTPUT«3 3 2 1 2␤»
03:56 camelia ..rakudo-jvm 319a78: OUTPUT«3 2 1 3 3␤»
03:56 camelia ..rakudo-parrot 319a78: OUTPUT«2 2 2 3 3␤»
03:56 ventica2 what's the point of $()?
03:57 lue to force item context instead of list context (lemme try to make an example real quick)
03:57 lue s/list context/some other context/
03:57 ventica2 k thx, appreciated
03:58 lue r: say $_.perl for (1,2,3);
03:58 camelia rakudo-{parrot,jvm,moar} 319a78: OUTPUT«1␤2␤3␤»
03:58 lue r: say $_.perl for $(1,2,3);
03:58 camelia rakudo-{parrot,jvm,moar} 319a78: OUTPUT«$(1, 2, 3)␤»
03:58 ventica2 the second loop executed just once, no?
03:58 lue when that list of three elements is seen in list context, you go through each item in the list. When the list is forced into item context, it's seen as a singular item.
03:59 ventica2 ok yeah i'm getting it
04:00 ventica2 m: say $_.perl for 1 & 2 & 3
04:00 camelia rakudo-moar 319a78: OUTPUT«all(1, 2, 3)␤»
04:00 ventica2 ok, so all/any/etc act a little bit like $()
04:01 ventica2 the junction is treated as a single item
04:01 lue perhaps, though using Junctions with that thought in your head will surely lead to Bad Things™
04:01 ventica2 haha ok
04:01 lue A Junction is really multiple things at once, rather than a collection of things.
04:01 ventica2 yes
04:02 kaare__ joined #perl6
04:02 ventica2 so, what I'm really looking for is a "collapse" function for the Junction... "Take this thing that can be ANY or ALL of these things and make it a TRULY single thing"
04:03 ventica2 how do I do that?
04:03 lue r: sub foo($a) { say $a }; foo((1,2,3)); foo(any(1,2,3));   # here's a quick way to show the difference between a list and junction
04:03 camelia rakudo-{parrot,jvm,moar} 319a78: OUTPUT«1 2 3␤1␤2␤3␤»
04:03 lue (and yes, the list in the first call was itemized because it was stuffed into a $ variable)
04:04 rurban1 joined #perl6
04:05 lue ventica2: in your case it would probably be best to use a normal list and just .pick a value
04:05 lue r: say (1,2,3).pick
04:05 camelia rakudo-jvm 319a78: OUTPUT«2␤»
04:05 camelia ..rakudo-{parrot,moar} 319a78: OUTPUT«3␤»
04:17 Pleiades` joined #perl6
04:22 atroxaper joined #perl6
04:24 nbrown joined #perl6
04:25 cognome joined #perl6
04:27 chenryn joined #perl6
04:45 gfldex joined #perl6
04:50 avuserow .tell itz thanks for the PR. what tests started failing on parrot 6.6.0? I think Rakudo 2014.07 used Parrot 6.6.0, so I wouldn't expect it to be that bad
04:50 yoleaux avuserow: I'll pass your message to itz.
04:53 avuserow timotimo++ # resuming weekly updates
04:56 avuserow m: say (so any(1,2,3)).perl
04:56 camelia rakudo-moar 319a78: OUTPUT«Bool::True␤»
04:56 avuserow m: say (+any(1,2,3)).perl
04:56 camelia rakudo-moar 319a78: OUTPUT«any(1, 2, 3)␤»
04:57 avuserow right.
05:19 kaare__ joined #perl6
05:20 dayangkun joined #perl6
05:22 [Sno] joined #perl6
05:23 ventica joined #perl6
05:24 rurban1 joined #perl6
05:25 raiph joined #perl6
05:25 cognome joined #perl6
05:31 chenryn joined #perl6
05:35 kaare_ joined #perl6
05:37 thou joined #perl6
05:43 bowtie joined #perl6
05:43 woolfy joined #perl6
05:44 dayangkun joined #perl6
05:47 jack_rabbit joined #perl6
05:52 ventica2 joined #perl6
05:55 bowtie_ joined #perl6
06:05 virtualsue joined #perl6
06:09 gamo joined #perl6
06:17 chenryn joined #perl6
06:19 sergot hi o/
06:21 woolfy left #perl6
06:25 cognome joined #perl6
06:29 bowtie_ joined #perl6
06:35 FROGGS[mobile] joined #perl6
06:35 c1sung joined #perl6
06:38 xinming_ joined #perl6
06:43 ventica2 avuserow: thanks
06:44 ventica2 say (so 1 | 2 | 3).perl
06:44 ventica2 m: say (so 1 | 2 | 3).perl # oops
06:44 camelia rakudo-moar 319a78: OUTPUT«Bool::True␤»
06:44 ventica2 aha
06:44 ventica2 m: say (so 0 & 2 & 3).perl
06:44 camelia rakudo-moar 319a78: OUTPUT«Bool::False␤»
06:44 ventica2 there we g
06:45 ventica2 m: say 1 + 2 & 3
06:45 camelia rakudo-moar 319a78: OUTPUT«all(3, 3)␤»
06:45 ventica2 m: say 1 + (2 & 3)
06:45 camelia rakudo-moar 319a78: OUTPUT«all(3, 4)␤»
06:45 ventica2 nice
07:10 virtualsue o/
07:14 raydiak \o
07:17 virtualsue_ joined #perl6
07:20 avuserow huh, I'm a little surprised that junctions don't drop duplicate values
07:21 dayangkun joined #perl6
07:21 avuserow m: my $j = 2; $j &= 2 for ^5; $j.perl.say
07:21 camelia rakudo-moar 319a78: OUTPUT«all(all(all(all(all(2, 2), 2), 2), 2), 2)␤»
07:22 FROGGS you need that, otherwise you cannot map that against the input...
07:22 salv0 joined #perl6
07:22 FROGGS m: say 2 ~~ 1 | 2 | 2 | 2 | 2 | 3
07:22 camelia rakudo-moar 319a78: OUTPUT«True␤»
07:22 moritz avuserow: at least the one() junction wouldn't work if it dropped duplicate values
07:22 FROGGS m: say 2 ~~ all 1 | 2 | 2 | 2 | 2 | 3
07:22 camelia rakudo-moar 319a78: OUTPUT«True␤»
07:22 FROGGS err
07:23 moritz you create an all-junction with one value, which is an any-junction
07:24 avuserow right, one() is special here. for some reason, the other junctions seem like they'd be more set-like than list-like in my mind. or maybe bag-like
07:25 avuserow I mean, certainly my idea does not pan out if you expected to be able to get the values from a junction, but IIRC that temptation is a bit discouraged
07:26 TimToady seems like one(1,2,2,2,3) could be optimized to one(1,3)
07:26 avuserow (except bags might still work?)
07:26 thou joined #perl6
07:26 nbrown joined #perl6
07:27 avuserow m: say so one(1, 2, 2, 2, 3)
07:27 camelia rakudo-moar 319a78: OUTPUT«False␤»
07:27 avuserow m: say so one(1, 3)
07:27 camelia rakudo-moar 319a78: OUTPUT«False␤»
07:27 avuserow oh I see
07:27 TimToady m: say so one(1,2,2,2,3) == 2
07:27 camelia rakudo-moar 319a78: OUTPUT«False␤»
07:27 TimToady m: say so one(1,2,2,2,3) == 3
07:27 camelia rakudo-moar 319a78: OUTPUT«True␤»
07:28 avuserow m: say so one(1, 3) == 2
07:28 camelia rakudo-moar 319a78: OUTPUT«False␤»
07:29 TimToady so it's still worthwhile finding the duplicates, but you do something different with them, is all
07:30 TimToady just as ^^ can short circuit on the second true
07:30 [Sno] joined #perl6
07:30 chenryn joined #perl6
07:30 TimToady m: say True ^^ False ^^ True ^^ die "oops"
07:30 [Sno] joined #perl6
07:30 camelia rakudo-moar 319a78: OUTPUT«Nil␤»
07:30 dayangkun joined #perl6
07:31 dmol joined #perl6
07:32 FROGGS somehow the v5 code that got translated from NQP to Perl 6 does not like multi tokens at all :o(
07:32 FROGGS (except token term...)
07:33 avuserow m: sub infix:<!>(**@values) { Junction.new(@values, :type<none>); }; say (1 ! 2 ! 3).perl
07:33 camelia rakudo-moar 319a78: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/ut_aiZURSWâ�¤Negation metaoperator not followed by valid infixâ�¤at /tmp/ut_aiZURSW:1â�¤------> [32mn.new(@values, :type<none>); }; say (1 ![33mâ��[31m 2 ! 3).perl[0mâ�¤    expecting any of:â�¤ …»
07:33 avuserow m: sub infix:<&!>(**@values) { Junction.new(@values, :type<none>); }; say (1 &! 2 &! 3).perl
07:33 camelia rakudo-moar 319a78: OUTPUT«none(none(1, 2), 3)␤»
07:35 avuserow still I wonder if junctions of a certain size would be better as Bags, assuming the values are hashable...
07:35 avuserow junctions aren't mutable right?
07:36 moritz right
07:36 TimToady no, so sets are good enough
07:37 TimToady though you'd need a second set to track one construction, so you'd know to remove that 2 and keep it removed
07:37 avuserow or just de-duplicating a list by hand, since that doesn't require hashability, you'd only do it once, and lists are cheaper?
07:38 TimToady well, requires a sort of some sort, likely
07:38 TimToady but a sorted list could be searched with a binary search, if you don't want to hash
07:39 avuserow do we have unhashable things in perl6? or is that $other-lang brain damage that I'm thinking of?
07:39 TimToady but a hash might be a good way to handle some ops $value eq any(@lots)
07:40 TimToady mutable objects including containers hash to their identity, not their contents
07:40 moritz but if you construct the hash for just one comparison, it's slower than going through it linearly
07:40 TimToady sure
07:51 TimToady zzz &
07:51 bjz joined #perl6
07:52 darutoko joined #perl6
07:55 hoverboard joined #perl6
07:56 bjz joined #perl6
07:57 zakharyas joined #perl6
08:04 bjz joined #perl6
08:07 timotimo o/
08:07 yoleaux 01:31Z <raiph> timotimo: https://gist.github.com/raiph/c1202f874c2477b09d1f irc summary trawl
08:07 dayangkun_ joined #perl6
08:07 virtualsue_ joined #perl6
08:10 raydiak \o
08:10 timotimo hey raydiak!
08:10 timotimo good to see you :)
08:10 raydiak thanks, you too :)
08:16 xinming joined #perl6
08:19 timotimo it'd be interesting if we could extract benchmarks from pray
08:20 timotimo have you tried pray recently?
08:21 timotimo especially yesterday and the day before that jnthn has improved performance nicely
08:21 timotimo even though some people are actually reporting performance hits
08:21 raydiak that was one of the thoughts I had as I was beginning it...I'm going to be working on math::threed and pray more very soon, so adding some stuff to it specific to benchmarks is a possibility
08:21 nwc10 has anyone run the benchmarks since ++jnthn++'s work?
08:21 timotimo i have, but it was missing parser speed improvements
08:21 raydiak I have tried it enough to confirm that it still works
08:21 timotimo so startup time would have been overestimated
08:22 raydiak (Pray I mean)
08:22 timotimo thought so
08:23 raydiak problem is I got a new (well, new to me) laptop, so comparing the speed of this to anything else is meaningless
08:23 timotimo ah, of course
08:23 timotimo did you know perl6-bench is a nice tool to build rakudo at different revisions?
08:24 raydiak oh, I think I was running them on my server before anyway...I ought to build a new rakudo on the vps and try pray again
08:24 raydiak is it?
08:24 timotimo like ./bench extract rakudo-moarvm/2014-05 rakudo-moarvm/2014-06 rakudo-moarvm/2014-07; ./bench build rakudo-moarvm/2014-05 rakudo-moarvm/2014-06 rakudo-moarvm/2014-07
08:24 raydiak oh neat
08:24 raydiak I usually use rakudobrew
08:24 timotimo in the bench case you don't need the "switch" part
08:25 timotimo but you don't get a perl6 binary for your path
08:25 Ven joined #perl6
08:25 raydiak might not want historical versions in your path anyway :)
08:26 Ven o/, #perl6.
08:26 timotimo that's correct
08:26 timotimo hey ven
08:26 raydiak hi Ven
08:26 raydiak are the performance improvements specific to moar?
08:26 timotimo partially
08:27 timotimo a big chunk of them are
08:27 raydiak I'll build that first them
08:27 raydiak *then
08:29 timotimo recent improvements to moar are a big chunk of "make more things inlinable at spesh time", so if pray happens to have been blocking on that in some place or other, there could certainly be a nice speed boost in store for you :)
08:30 kaleem joined #perl6
08:31 timotimo that might also explain the performance hit some people saw so far; we can do more inlinings and maybe they don't end up benefiting performance as much as they take to be done
08:31 denis_boyun joined #perl6
08:31 chenryn joined #perl6
08:32 timotimo only speculations at this point, though
08:32 raydiak hard to say what my bottleneck is...I think Pray is blocking on the fact that at least in the master branch no attempt has ever been made to pay any attention to performance
08:32 timotimo oh, you mean the pray code isn't performance-optimized?
08:33 raydiak heck no :)
08:33 timotimo that's good, though
08:33 timotimo it'd point us at things that'd appear in "regular code" that ought to be faster, but isn't
08:34 raydiak to an extent...I'm sure some of it is just outright wrong in retrospect, I'll be finding out as I dig back in
08:34 timotimo hah, all right :)
08:34 timotimo i'm just glad you chose to fly with perl6 airlines
08:34 raydiak heh me too
08:35 raydiak getting new hardware helped...Pray was developed on a VPS w/half a gig ram, via a half-broken laptop from 2007 w/no hard drive
08:35 FROGGS_ joined #perl6
08:36 timotimo ah, that does sound like something you may want to update
08:37 raydiak I kinda prided myself on being able to limp it by with lean desktops and excessive console use, but that looses entertainment value after a certain amount of time
08:37 timotimo mhm
08:38 timotimo i've gone back and forth between "geek pride" "hard core" setups and "end-user fancy flashy stuff" multiple times in the past
08:38 timotimo kde3 followed by awesome (then xmonad and then i3)
08:38 timotimo and then xfce4
08:38 tempire joined #perl6
08:39 raydiak I've been through so many...back in my gentoo days I'd change window managers a few times a week for a while...using mint kde atm
08:39 timotimo at some point i was on gentoo, even did a stage1 build at some point, but that was after (i think) debian and followed by debian, later on fedora
08:39 timotimo oh, debian, then mint (with cinnamon) and then fedora
08:41 raydiak I've tried to some extent or another at some point between the 90s and now slackware, gentoo, redhat, debian, ubuntu, mint, arch, mandrake, puppy, knoppix, portage...
08:42 raydiak can't remember it all, or at least I try not to
08:42 timotimo hah, i also used mandrake for a short while
08:43 timotimo back when it was actually called mandrake and not mandriva
08:43 timotimo that was my very second linux distro ever
08:43 timotimo back then i didn't really know what to do with a linux system; i was much more into gaming then than i am now
08:43 masak good antenoon, #perl6
08:44 raydiak yeah they had the best hardware autodetection back in the day, I loved the lesser extent I had to futz with kernel modules and so forth
08:44 raydiak \o masak
08:44 masak m: my $jnthn; say ++$jnthn++
08:44 camelia rakudo-moar 319a78: OUTPUT«Cannot assign to an immutable value␤  in sub postfix:<++> at src/gen/m-CORE.setting:4561␤  in block  at /tmp/DaBFPrSdkk:1␤␤»
08:44 masak m: my $jnthn; say (++$jnthn)++
08:44 camelia rakudo-moar 319a78: OUTPUT«Cannot assign to an immutable value␤  in sub postfix:<++> at src/gen/m-CORE.setting:4561␤  in block  at /tmp/SYaGRCX_xc:1␤␤»
08:44 masak m: my $jnthn; say ++($jnthn++)
08:44 camelia rakudo-moar 319a78: OUTPUT«Cannot assign to an immutable value␤  in sub prefix:<++> at src/gen/m-CORE.setting:4553␤  in block  at /tmp/Tn1QylpxaJ:1␤␤»
08:45 jnthn ++ returns the value, not the container
08:45 masak turns out pre-post-incrementing jnthn's karma is too much :)
08:45 * masak .oO( circumincrement )
08:46 Mouq_ joined #perl6
08:55 masak prompted by Perl Weekly -- why are formats so rarely used?
08:55 masak is it due to a shift in what's fashionable/interesting? or were they always rarely used?
08:56 timotimo masak: formats, as in @foobar.fmt("this thing in here") #?
08:56 masak hehe, no :)
08:56 masak as in `perldoc perlform`
08:56 masak as in http://www.learning-perl.com/2014/07/formats/
08:56 kurahaupo joined #perl6
08:57 timotimo oh!
08:57 timotimo that's kinda cute
08:58 masak as in http://www.perl.com/pub/2004/02/27/exegesis7.html
08:58 masak as in https://github.com/mathw/form/
08:58 Ven oh, I never knew about that
08:58 timotimo that's far from implemented, isn't it?
08:59 timotimo did it actually end up as part of the spec?
08:59 masak no, and that's part of my point.
08:59 masak it was exiled to module-land from the start.
08:59 timotimo ah
08:59 masak E07 has no synopsis.
08:59 timotimo well, yeah, i can see how it'd be quite good in a module
08:59 masak S07 today is about something else (lists and iteration).
09:00 masak my question is about the history and evolution of the use of formats.
09:00 masak where do they come from originally? were they a Perl invention?
09:00 masak were they once wildly popular?
09:02 moritz they were pretty popular once, yes
09:04 [particle] joined #perl6
09:05 kurahaupo_mobile joined #perl6
09:05 masak moritz: about the only data I have to support that is the "R" in "Perl" :)
09:05 bjz joined #perl6
09:05 raydiak my general impression was that they are crufty and limited...ascii soup, weird scoping rules iirc, stuff like that, and not something that likely belongs in the core anyway, given our shift away from dot-matrix printers and monospaced characters for typographic layout
09:05 raydiak straight out of perlform:
09:06 raydiak "Pretty ugly, eh? It's a common idiom though, so don't be too surprised when you see it."
09:06 ventica2 what is gabor szabo's nick? (i'm watching his YT video tutorials)
09:06 timotimo szagab usually
09:06 timotimo !seen szagab
09:06 ventica2 thx
09:06 timotimo yoleaux: seen szagab
09:06 timotimo how do i ...
09:07 masak szabgab usually.
09:07 timotimo oh
09:07 masak it's a Hungarian thing, I think, to put the last name first.
09:07 * ventica2 thinks of cracking bad pun about hungarian notation...
09:07 chenryn joined #perl6
09:08 masak heh.
09:08 timotimo oh hey ventica2
09:08 ventica2 yes
09:08 timotimo i see you've "discovered" junctions
09:08 ventica2 haha yeha, i used quantum:: back in the day
09:08 timotimo it felt like i was the only person to like junctions when i last worked on them
09:09 ventica2 yeah, I think it will become a killer-app feature of langs after p6 hits mainstream... :)
09:09 timotimo i do agree that if you do something like return junctions from your module's interface-defined subs and methods, that's pretty evil
09:10 ventica2 hmm, not sure it's evil... a search function for example might want to say "i found one of X or Y or Z"
09:10 timotimo it does funky things with calls :)
09:11 ventica2 implementation bug?
09:11 timotimo no
09:11 ventica2 or arch bug?
09:11 timotimo anyway, you usually have to declare your variables to hold a Mu if you want to handle junctions
09:11 timotimo that's just how junctions work
09:11 FROGGS_ .seen szabgab
09:11 ventica2 k
09:11 yoleaux I haven't seen szabgab around.
09:11 timotimo m: sub do_something($a) { say "i'm doing something with $a. cool, huh?"; return Bool.pick }; say do_something(1 | 2 | 3).perl
09:11 camelia rakudo-moar 319a78: OUTPUT«i'm doing something with 1. cool, huh?␤i'm doing something with 2. cool, huh?␤i'm doing something with 3. cool, huh?␤any(Bool::False, Bool::False, Bool::True)␤»
09:12 masak I used to be wildly in love with junctions, too.
09:12 timotimo this is called "autothreading" (not actually multi-threading across cores/threads though (yet))
09:12 masak nowadays I consider them to be one of those rather narrow power features to be used in a limited, controlled scope.
09:13 timotimo i think the next thing i ought to do with junctions is apply the same optimizing transformation to any(<foo bar baz>) that would happen to "foo" | "bar" | "baz" (in boolean context, that is)
09:13 moritz ventica2: Gabor mostly stopped using IRC about two years ago, IIRC
09:14 timotimo irc is quite the time sink :)
09:14 moritz ventica2: but it should be possible to reach him by e-mail
09:14 ventica2 moritz: ah
09:14 ivan`` joined #perl6
09:14 timotimo or twitter, i think
09:14 ventica2 was jst curious if he's around to say "nice job!" on the tuts
09:14 thou joined #perl6
09:14 timotimo can send a comment on youtube/google+
09:14 kivutar joined #perl6
09:15 ventica2 m: sub foo($a) { return "blah $a"; }; foo(1|2|3);
09:15 camelia rakudo-moar 319a78: ( no output )
09:15 ventica2 m: sub foo($a) { return "blah $a"; }; say foo(1|2|3); #oops
09:15 camelia rakudo-moar 319a78: OUTPUT«any(blah 1, blah 2, blah 3)␤»
09:15 ventica2 m: sub foo($a) { say "blah $a"; }; foo(1|2|3);
09:15 camelia rakudo-moar 319a78: OUTPUT«blah 1␤blah 2␤blah 3␤»
09:15 ventica2 oooooooooookay
09:15 ventica2 finally
09:16 timotimo you see now how that can cause unexpected things? :)
09:16 ventica2 it seems that junctions aren't considered a readability feature?
09:17 timotimo they are totally good for readability
09:17 ventica2 yeah... but... seems like they could be made a bit more DWIMmy
09:17 timotimo consider if $x & $y == -1 | 0 | 1
09:17 timotimo how so?
09:18 ventica2 hmm, maybe i just need more time with them... it seems they should be a little more eager to resolve to "classical" states, i.e. to "de-junctionize"
09:18 Ven timotimo: took me some time to understand what that meant
09:19 timotimo ventica2: they de-junctionize if you .Bool them
09:19 ventica2 m: my $x = 1; my $y = 0; say ($x & $y == -1 | 0 | 1).perl;
09:19 camelia rakudo-moar 319a78: OUTPUT«all(any(Bool::False, Bool::False, Bool::True), any(Bool::False, Bool::True, Bool::False))␤»
09:19 moritz ventica2: if you want a non-boolean result out of a junction, you shouldn't be using a junction (but a Set)
09:20 ventica2 timo: aha! let me try:
09:20 ventica2 m: my $x = 1; my $y = 0; say ($x & $y == -1 | 0 | 1).Bool.perl;
09:20 camelia rakudo-moar 319a78: OUTPUT«Bool::True␤»
09:20 timotimo m: my $x = 1; my $y = 0; say so $x & $y == -1 | 0 | 1;
09:20 camelia rakudo-moar 319a78: OUTPUT«True␤»
09:20 ventica2 theeeeeeeere we go!
09:20 ventica2 ha, u guys made my night
09:20 Ven yay :)
09:20 timotimo being able to .say a Junction is considered A Feature
09:20 ventica2 what is the mnemonic for 'so'
09:20 ventica2 ?
09:20 timotimo "opposite of not"
09:21 ventica2 as in "it is so" ?
09:21 timotimo yup
09:21 ventica2 lol TimToady
09:21 timotimo that's also why we have ... ?? ... !! ... instead of ... ? ... : ...
09:21 ventica2 that's got to be his idea
09:21 timotimo not only because the : is for other things now
09:22 timotimo because prefix:<?> is the opposite of prefix:<!>, i.e. boolification without negation
09:22 ventica2 m: my $x = 1; my $y = -1; say ($x & $y == -1 | 0 | 1).Bool.perl;
09:22 camelia rakudo-moar 319a78: OUTPUT«Bool::True␤»
09:22 ventica2 m: my $x = 1; my $y = 2; say ($x & $y == -1 | 0 | 1).Bool.perl;
09:22 camelia rakudo-moar 319a78: OUTPUT«Bool::False␤»
09:22 timotimo so in the ternary operator, the ?? comes before what is the result for a "true" condition, and after the !! is the result for a "false" condition
09:22 ventica2 m: my $x = 1; my $y = 2; say ($x | $y == -1 | 0 | 1).Bool.perl;
09:22 camelia rakudo-moar 319a78: OUTPUT«Bool::True␤»
09:22 ventica2 ^ exactly what I expect
09:23 timotimo great, huh? :)
09:23 ventica2 :D
09:23 ventica2 timo: Yeah, same as C
09:23 timotimo that's the part of junctions i really enjoy having
09:23 timotimo bwahaha
09:23 ventica2 just different squigglies :P
09:23 timotimo would $x | $y == -1 | 0 | 1 in C actually work? %)
09:23 timotimo through some ridiculous coincidence of bit masks
09:23 ventica2 moritz: OK, I haven't gotten to sets yet
09:24 ventica2 timo: No, i meant the ternary operator
09:24 masak no, no, the mnemonic of "so" is children going "not X!" -- "so X!"
09:25 ventica2 lol
09:25 masak or "that is *so* true" as an opposite of "that is *not* true"
09:25 ventica2 "dude, that is so X!" where "X == cool"
09:25 timotimo m: say so "perl6" ~~ Cool
09:25 camelia rakudo-moar 319a78: OUTPUT«True␤»
09:25 jnthn m: say so not True # :-)
09:25 camelia rakudo-moar 319a78: OUTPUT«False␤»
09:26 timotimo m: say not so True
09:26 ventica2 lol... p6 poetry...
09:26 camelia rakudo-moar 319a78: OUTPUT«False␤»
09:26 ventica2 wait... how does "perl6" match Cool??
09:27 timotimo m: say "perl6".^mro
09:27 camelia rakudo-moar 319a78: OUTPUT«(Str) (Cool) (Any) (Mu)␤»
09:27 masak m: for ^10 { say EVAL "not " x $_ ~ "True" }
09:27 camelia rakudo-moar 319a78: OUTPUT«True␤False␤True␤False␤Tru​e␤False␤True␤False␤True␤False␤»
09:27 ventica2 lol ... um
09:27 timotimo m: say (True, not * ... *)[^10
09:27 camelia rakudo-moar 319a78: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/FBDCI1Z5G7â�¤Unable to parse expression in subscript; couldn't find final ']' â�¤at /tmp/FBDCI1Z5G7:1â�¤------> [32msay (True, not * ... *)[^10[33mâ��[31m<EOL>[0mâ�¤    expecting any of:â�¤     …»
09:27 timotimo m: say (True, not * ... *)[^10]
09:27 camelia rakudo-moar 319a78: OUTPUT«True False True False True False True False True False␤»
09:28 Ven timotimo: oh wow, that's cool :DD
09:29 ventica2 hrm, not grokking that
09:29 timotimo the ... operator?
09:29 Ven well, it's the sequence operator using a closure as the "next"
09:29 ventica2 looks like * is somehow using the "last" value in constructing the lazy array slice?
09:29 ventica2 am i completley off?
09:30 masak m: enum Trool <False Meow True>; sub knot(Trool $t) { Trool(($t + 1) % 3) }; for ^10 { say EVAL "knot " x $_ ~ "Trool::False" }
09:30 camelia rakudo-moar 319a78: OUTPUT«False␤Meow␤True␤False␤Me​ow␤True␤False␤Meow␤True␤False␤»
09:30 Ven it's the Whatever, and here, it creates a closure
09:30 timotimo no, that's right; but it's the ... operator that is responsible for that
09:30 ventica2 but where's the closure coming from?
09:30 masak strangest code I've written in a while ;)
09:30 Ven m: (not *)(True); # ventica2
09:30 camelia rakudo-moar 319a78: ( no output )
09:30 Ven m: say (not *)(True); # ventica2 / ENOSAY
09:30 camelia rakudo-moar 319a78: OUTPUT«False␤»
09:31 timotimo the ... operator takes, on its left hand side, a list of initial values. but if the list of initial values ends in a callable, it'll be using that as the generator for new values
09:31 ventica2 ohhhhhh
09:31 timotimo maybe you've read it as "True, not (* ... *)"
09:31 ventica2 so you can have (* ... foo())?
09:31 masak m: enum Trool <False Meow True>; sub knot(Trool $t) { Trool(($t + 1) % Trool.WHO.elems) }; for ^10 { say EVAL "knot " x $_ ~ "Trool::False" }
09:31 camelia rakudo-moar 319a78: OUTPUT«False␤Meow␤True␤False␤Me​ow␤True␤False␤Meow␤True␤False␤»
09:31 timotimo ventica2: that would use foo to determine whether or not to stop creating new values
09:32 ventica2 oh
09:32 ventica2 8|
09:32 zakharyas joined #perl6
09:32 timotimo what you're looking for would probably look more like this:  1, &foo ... * > 10
09:32 timotimo or something similar
09:32 ventica2 k
09:33 timotimo m: .say for (1, &rand ... * < 0.01)
09:33 camelia rakudo-moar 319a78: OUTPUT«1␤0.63806099432048␤0.99600266644003␤0.627​999792034536␤0.424795260287713␤0.773997386634655​␤0.930332430721908␤0.0731129034402533␤0.62469018​7159723␤0.378498143362509␤0.900633295939546␤0.16​7187315044206␤0.770091165681623␤0.97043794096…»
09:33 timotimo m: say rand(10)
09:33 camelia rakudo-moar 319a78: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/ep0hFjK1tS�Unsupported use of rand(N); in Perl 6 please use N.rand or (1..N).pick�at /tmp/ep0hFjK1tS:1�------> [32msay rand[33m�[31m(10)[0m�»
09:33 timotimo ah, ok
09:33 timotimo m: .say for (1, { rand * $_ } ... * < 0.01)
09:33 camelia rakudo-moar 319a78: OUTPUT«1␤0.892413575163273␤0.822827642810​902␤0.759099022921723␤0.0162804340793365␤​0.0123253346263869␤0.00537682554377414␤»
09:33 timotimo m: .say for (1, { rand * $_ } ... * < 0.01)
09:33 camelia rakudo-moar 319a78: OUTPUT«1␤0.674718120498933␤0.504576203895648␤0.2​77071311046884␤0.272918659793391␤0.2405955047677​05␤0.190853393534245␤0.163029548975817␤0.0819790​525609101␤0.0648692437531501␤0.0279766166199596␤​0.0172190678642668␤0.0145456946016295␤0.00034…»
09:33 timotimo m: .say for (1, *.rand ... * < 0.01)
09:33 camelia rakudo-moar 319a78: OUTPUT«1␤0.696997511073613␤0.614248​875876916␤0.338122651616165␤0.02890​01131197655␤0.00732885836923004␤»
09:34 timotimo m: .say for (1, *.rand ... * < 0.0001)
09:34 camelia rakudo-moar 319a78: OUTPUT«1␤0.894375562174117␤0.63748354142407␤0.50​9248141468545␤0.360450555755423␤0.31626819694223​2␤0.282577593425415␤0.249381263229318␤0.18316330​0749547␤0.136788393139608␤0.132964163895922␤0.03​31698493581032␤0.00457938070950557␤0.00281906…»
09:34 timotimo ^- perfectly useful sequence of "randomly" spaced decreasing numbers
09:37 pecastro joined #perl6
09:38 moritz wy does that only produce decreasing numbers?
09:39 moritz *why
09:39 moritz ah, because we call .rand on the previous number
09:39 Ven moritz: because .rand will never produce something greater than its self
09:39 ventica2 m: say 1 .. 10;
09:39 jnthn Because the previous thing is what we call .rand on
09:39 moritz clever
09:39 camelia rakudo-moar 319a78: OUTPUT«1..10␤»
09:39 ventica2 m: say (1..10).perl;
09:39 camelia rakudo-moar 319a78: OUTPUT«1..10␤»
09:39 ventica2 m: say $_ for (1..10);
09:39 camelia rakudo-moar 319a78: OUTPUT«1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤»
09:40 ventica2 m: say $_ for (1,3...10);
09:40 ventica2 oops
09:40 camelia rakudo-moar 319a78: OUTPUT«(timeout)1␤3␤5␤7␤9␤11␤13␤15␤17␤19␤2​1␤23␤25␤27␤29␤31␤33␤35␤37␤39␤41␤43␤45␤47␤4​9␤51␤53␤55␤57␤59␤61␤63␤65␤67␤69␤71␤73␤75␤7​7␤79␤81␤83␤85␤87␤89␤91␤93␤95␤97␤99␤10…»
09:40 ventica2 wait, what?
09:40 Ven ventica2: it doesn't hit 10, so doesn't stop :)
09:41 Ven m: say $_ for (1,3... * > 10);
09:41 camelia rakudo-moar 319a78: OUTPUT«1␤3␤5␤7␤9␤11␤»
09:41 ventica2 i see
09:42 moritz m: say $_ for (1,3...^ * > 10);
09:42 camelia rakudo-moar 319a78: OUTPUT«1␤3␤5␤7␤9␤»
09:43 ventica2 i think it should detect > 10 in a DWIMmy way
09:43 ventica2 otherwise, too susceptible to hang conditions
09:44 ventica2 unintended
09:44 masak no no, it's a *fun* way to teach people to be careful with infinity! :P
09:44 Ven it used it, afaik
09:44 Ven it used to*
09:45 ventica2 Ven: yeah, in szabgab's tuts, he shows it stopping before 10 for odd no.s
09:46 ventica2 masak: perhaps... but seems to me to violate the principle of least surprise... :\
09:46 masak the scheme that dwam 10 was way complicated.
09:47 masak and the complexity bit more than it served.
09:47 Ven yeah, you need to deduce the "direction", right ?
09:47 masak yep.
09:48 Timbus ?
09:48 Timbus m: say 5 ... 1
09:48 camelia rakudo-moar 319a78: OUTPUT«5 4 3 2 1␤»
09:48 masak m: say 11, 9 ... 0
09:48 camelia rakudo-moar 319a78: OUTPUT«(timeout)»
09:49 masak (oops, missed) :)
09:49 moritz ventica2: we had automagic detection of upper limits once
09:49 moritz ventica2: it was a complete mess with non-monotonic sequences
09:49 masak queue moritz retreading my steps :P
09:49 masak moritz++
09:49 ventica2 seems to me that non-monotonic is the problem
09:50 ventica2 personally, i'd say dispense non-monotonic and preserve principle of least surprise for monotonic sequences
09:50 masak now you're just insisting on things being as simple as you'd like :)
09:50 jnthn Well, infix:<...> is just an operator, so you an always write a module that implements the ... you'd like.
09:51 masak sure, if you can prove monotonicity, then you can do clever things with detecting timeouts.
09:51 moritz ... and be surprised how many corner cases lurk in such a seemingly simple operator
09:51 ventica2 masak: perhaps... or maybe it's not abt simplicity so much as not introducing unintended bugs when using variables in a sequence construction
09:51 ventica2 $init, $next ... $final
09:52 moritz what does that do when $next < $init < $final ?
09:52 masak ventica2: I can definitely see a case for special-casing the simple linear case. but it does feel a little like a slippery slope.
09:52 ventica2 for any value of init, next and final, I know what thta means (or error) for monotonic sequences... for non-monotonic, I have no idea what's going to happen
09:52 jnthn ventica2: A hang is a pretty obvious bug; I seem to recall the ones introduced by the DWIM-y end point were much more subtle and harder to figure out.
09:52 masak moritz: that could also be detected.
09:52 moritz masak: sure it can; but what to do?
09:52 moritz also
09:52 ventica2 idk, I just think of it as a range() function baked into the syntax
09:52 moritz one must be careful not to introduce different behavior between  1, 3 ... 10 and 1, *+2 ... 10
09:53 masak moritz: why is that important?
09:53 moritz masak: consistency
09:53 jnthn 'cus I'd expect to be able to do a refactor like that without changing the semantics.
09:53 masak this is about catching statically-determinable beginner mistakes.
09:54 moritz oh
09:54 moritz you want extra compile-time analysis
09:54 masak moritz: if one dies at compilation, and the other loops infinitely, then that's not immediately "different behavior" to me. it's just we caught one of them.
09:54 masak yes.
09:54 * ventica2 doesn't see a large distinction between beginner(self) and expert_hasnt_used_this_featu​re_in_a_couple_months(self)
09:54 masak could even be a warning :)
09:54 moritz masak: I missed that part
09:54 Ven .oO( ERROR: it seems you're unable to count up to 10 )
09:55 masak we detect all kinds of wrong signature binding at compile time. why not wrong sequences?
09:55 moritz m: say (100, 45, *%* ... 0)[*-2]
09:55 camelia rakudo-moar 319a78: OUTPUT«5␤»
09:55 moritz I still love that GCD implementation
09:55 ventica2 O.o
09:56 Ven haha nice
09:57 mathw ah yes, formats. definitely better in a module.
09:58 masak mathw++ # making that module
09:58 mathw yeah shame I never maintain it...
09:58 mathw and have never finished it...
09:58 masak mathw: we could hackathon it sometime.
09:58 mathw might be a good idea
09:58 mathw give me a Perl 6 knowledge refresh/update too
09:58 masak oh, 'd love to!
09:59 mathw so focussed lately on C# at work, and using Clojure for some home stuff
09:59 mathw was using Haskell but got bitten by the dependency hell so backed off for a while
09:59 timotimo #perl6 memes. today: GMM; Good Man Masak
09:59 masak :P
09:59 timotimo in perl6 land we got rid of the "dependency hell" by not having any modules you can depend on!
09:59 mathw My local PM group are going to start having technical talks, they want something Perl 6-ish and of course they're all looking at me...
10:00 masak mathw: dependency hell in Haskell? I thought those people were all into immutable stuff...
10:00 xiaomiao dependency hell is just a matter of having good policies and a package manager available
10:00 masak xiaomiao: "just", huh? :P
10:00 xiaomiao e.g. perl5: no cyclical dependencies in cpan, ever
10:00 mathw yeah... it's not that simple in Haskell-land
10:00 xiaomiao that's a massive lesson that the ruby people won't learn, so their stuff is impossible to install
10:00 masak xiaomiao: are there package managers with cyclical dependencies!!??? h... how?
10:00 moritz xiaomiao: and reliable infrastructure, and packages declaring all deps correctly, ...
10:00 mathw cyclical dependencies???
10:00 masak I... how?
10:01 mathw no, Haskell has problems with versioning
10:01 xiaomiao mostly tests depending on things that need that package installed to run
10:01 mathw package A depends on B 1.0.3, package C (which you also want) uses B 1.0.5
10:01 xiaomiao so you have to disable all tests to install things
10:01 mathw this usually causes some sort of explosion
10:01 moritz if you have some kind of transaction thingy, and deps don't need to be satisfied inside the transaction, you can have cyclic deps
10:01 xiaomiao e.g. gem :)
10:02 xiaomiao mathw: you should never need such precise deps, unless your code is so fragile that you'll bundle that in directly
10:02 xiaomiao bundling is bad!
10:02 fhelmberger joined #perl6
10:02 timotimo bundling is fun!
10:02 mathw especially as Hackage (Haskell-like CPAN) has a lot of packages with upper version bounds that are way too tight or just too cautious
10:02 xiaomiao usually, most of the time, <=1.0.0 would be ok
10:02 mathw a lot of packages have broken interfaces on 0.0.1 increments etc.
10:02 xiaomiao forcing =1.0.3 like ruby people like to do is bad
10:02 Ven you can have cyclical deps in JS :P
10:02 mathw bad policies, no enforcement etc.
10:02 xiaomiao bad code :)
10:02 mathw Haskell library community needs to mature
10:03 mathw and they're trying to find a good solution
10:03 xiaomiao they all need to mature, and mostly get rid of the stupid
10:03 timotimo i hope we're doing well with the learning from other people's mistakes with perl6 on this topic
10:03 xiaomiao e.g. python/pip, it's ... augh
10:03 mathw and it's a shame, because it's the only thing holding me back from trying to get everyone using Haskell for everything they're not using Perl 6 for
10:04 Ven JS land has specifically-pinned version everywhere
10:04 xiaomiao Ven: JS is based on bundling
10:05 Ven (and I use it too, because sometimes your stuff breaks in a minor update and you're like wtf)
10:05 xiaomiao always stapling everything together
10:06 Ven mathw: looks like the paris pm group will also stuff perl 6 stuff soon :)
10:09 xfix joined #perl6
10:09 xfix joined #perl6
10:10 mathw Ven: they all want Perl 6 to happen, it seems, because I've been teasing them about how cool it is
10:10 Ven m: say "{"
10:10 camelia rakudo-moar 319a78: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/rQrhVcMnoGâ�¤Unable to parse expression in double quotes; couldn't find final '"' â�¤at /tmp/rQrhVcMnoG:1â�¤------> [32msay "{"[33mâ��[31m<EOL>[0mâ�¤    expecting any of:â�¤        statement lis…»
10:10 Ven mathw: hehe, exactly :o)
10:11 * Ven teased them in a talk where he barely had 2 slides which some baby perl 6 code
10:11 mathw unfortunately the amount of happening Perl 6 has already had isn't quite enough for them at this point in time
10:11 mathw and most of them are working with big Perl 5 codebases so there's that problem to deal with
10:11 mathw they're all on board with modern Perl though, which is great
10:12 mathw and then I sometimes get a bit jealous because my job is C# and it's annoying
10:12 mathw especially when we've all got F# development environments because it comes with Visual Studio
10:12 timotimo and you're not allowed F# at all?
10:14 mathw it's something I need to start trying to persuade people to do
10:14 xfix joined #perl6
10:14 xfix joined #perl6
10:14 mathw unfortunately they look at C# and it's familiar and the tooling's big and sophisticated (ReSharper)
10:15 * jnthn can't use ReSharper; it's just too noisy
10:15 jnthn Plain VS stays out of my way enough.
10:15 mathw and they look at F# and it's weird and therea ren't any {} and ReSharper doesn't support it (not that F# really needs that much help) and it's just new and weird and...
10:15 mathw I now rely on a few ReSharper features, but that's just saving me time when I'm dealing with C#'s peculiarities
10:16 mathw if we were using a proper language...
10:16 timotimo that's a jetbrains product, isn't it?
10:16 mathw yeah
10:16 jnthn Yeah. It's decent enough. It just doesn't fit with the way I work.
10:16 timotimo jetbrains make really good stuff
10:16 mathw really expensive addon for Visual Studio (which is really expensive) that gives it loads of features it should've already had
10:16 mathw and a load of other features you shouldn't need
10:16 timotimo can't wait for the stuff they come up with when perl6 actually gets popular %)
10:17 mathw marvellous work they've done on it, but it's a solution for a problem that we shouldn't have
10:17 ssutch joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs