Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2015-07-12

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:00 ab5tract_ now that CompUnitRepos are shaping up, maybe we could automatically store compiled versions of whatever you've been running with perl6
00:00 ab5tract_ do some sort of CRC check against the file to see if it has changed and needs to be re-compiled
00:01 ab5tract_ panda look is and awesome feature
00:01 ab5tract_ *an
00:02 tinyblak joined #perl6
00:03 ab5tract_ AlexDaniel: don't despair. just create a META.json/META6.json and use the existing panda tooling. `panda look` is an easy way to get examples of those files
00:04 AlexDaniel ab5tract_: not today, I guess
00:04 AlexDaniel ab5tract_: I thought there would be some really easy way to do that
00:04 AlexDaniel ab5tract_: but if not, ok, I don't need it right now :)
00:04 ab5tract_ yeah, there is. META.json is like ~20 lines
00:04 ab5tract_ ;)
00:04 ab5tract_ probably even less
00:06 AlexDaniel ab5tract_: not easy enough :) at least for today
00:06 ab5tract_ fair enough.
00:08 ugexe you can precompile a file by doing perl6 --target=mbc --output=lib/File.pm6.moarvm lib/File.pm6
00:09 ugexe or you can use CompUnit.precomp
00:13 AlexDaniel ugexe: hm, but this still means that the main file is not precompiled? Do I get it right?
00:14 ugexe there has to be a perl6 entry point
00:14 AlexDaniel For example, if I do perl6 --stagestats test.p6 where test.p6 is just say 'hello' it says that 0.169 is spent on Stage parse
00:15 ugexe so there will (as of right now anyway) be a non-compiled point that gets run
00:15 AlexDaniel so I'm thinking, if spends so much time on that, is there any way to skip that?
00:16 AlexDaniel if it*
00:16 Ulti pyrimidine: are you in Dublin atm?
00:17 ugexe you can precompile your script, but then you have to 'use lib "your-script"' in another script to actually invoke it
00:17 ugexe liely defeating the purpose
00:18 AlexDaniel any reason why this entry point cannot be precompiled as well?
00:22 mohij_ joined #perl6
00:25 pecastro joined #perl6
00:25 vendethiel joined #perl6
00:39 AlexDaniel Here http://doc.perl6.org/type/Proc it says that I can pass IO::Pipe or IO::Handle as :in(). But how can I pass a Str? Or is there any way quick way to create IO::Handle from Str?
00:40 AlexDaniel looks like a common problem – pass string as stdin
00:47 ugexe IO::Handle has both print and say methods. also write
00:47 ugexe but im not sure you can pass your own pipe into Proc yet
00:50 cognominal joined #perl6
00:51 pyrimidi_ joined #perl6
00:52 pyrimidi_ Ulti: couldn't make it this year, BOSC was awesome from a distance tho
01:16 rmgk_ joined #perl6
01:17 Hor|zon joined #perl6
01:19 aborazmeh joined #perl6
01:19 aborazmeh joined #perl6
01:20 colomon joined #perl6
01:27 tad_ joined #perl6
01:30 colomon joined #perl6
01:46 ilbot3 joined #perl6
01:46 Topic for #perl6 is now »ö« Welcome to Perl 6! | http://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: http://irc.perl6.org | UTF-8 is our friend!
01:51 pyrimidi_ joined #perl6
01:55 cognominal joined #perl6
01:57 adu joined #perl6
02:00 skids joined #perl6
02:00 Quom m: my $s = "OH 819"; for $s { s:g/(\d){}/{chr(64 + $0)}/; .say }
02:00 camelia rakudo-moar 81d173: OUTPUT«OH III␤»
02:00 Quom Very strange
02:06 tinyblak joined #perl6
02:10 vendethiel joined #perl6
02:11 atroxaper joined #perl6
02:13 AlexDaniel Quom: so it is using the last number?
02:14 noganex joined #perl6
02:16 Quom AlexDaniel: Yeah, IDK what's going on there. Some kind of optimization gone wrong
02:16 Quom m: my $s = "OH 819"; for $s { my $/; s:g[(\d){}]=chr(64 + $_); .say }
02:16 camelia rakudo-moar 81d173: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏OH 819' (indicated by ⏏)␤  in block  at /tmp/ic2riGE_eq:1␤␤»
02:16 Quom m: my $s = "OH 819"; for $s { my $/; s:g[(\d){}]=chr(64 + $0); .say }
02:16 camelia rakudo-moar 81d173: OUTPUT«OH HAI␤»
02:17 tinyblak_ joined #perl6
02:17 Quom m: my $s = "OH 819"; for $s { my $/; s:g[(\d)]=chr(64 + $0); .say }
02:17 camelia rakudo-moar 81d173: OUTPUT«OH HAI␤»
02:17 Quom Well, there's a workaround
02:18 AlexDaniel m: my $s = "OH 819"; $s ~~ s:g/(\d)/{chr(64 + $0)}/; $s.say;
02:18 camelia rakudo-moar 81d173: OUTPUT«OH HAI␤»
02:18 AlexDaniel Quom: what about this?
02:22 colomon joined #perl6
02:24 AlexDaniel m: my $s = "OH 819"; for $s { s:g/(\d)/$0/; .say; }
02:24 camelia rakudo-moar 81d173: OUTPUT«Use of Nil in string context  in code  at /tmp/7uxTWAuEqS:1␤Use of Nil in string context  in code  at /tmp/7uxTWAuEqS:1␤Use of Nil in string context  in code  at /tmp/7uxTWAuEqS:1␤OH ␤»
02:24 AlexDaniel why is it Nil?
02:27 kurahaupo joined #perl6
02:33 kurahaupo joined #perl6
02:35 zostay joined #perl6
02:36 ugexe because you are calling say on something that doesnt match fir the first3 iterations
02:39 adu joined #perl6
02:42 AlexDaniel ugexe: what kind of iterations?
02:43 ugexe oh i see i missed the semicolon
02:44 AlexDaniel hmmm which semicolon
02:49 ugexe at the end of the regex. like .say was getting called every time the cursor advanced and the match fails
02:51 AlexDaniel anyway, why $0 is Nil if it clearly matched something?
02:51 ugexe it looks like its due to replacing something with itself
02:52 ugexe im not sure how the guts of all that work, but seems like its removing the reference to the \d, then trying to replace it with the now non-existant variable?
02:52 AlexDaniel m: $_ = "OH 819"; s:g/(\d)/$0/ for $_; .say;
02:52 camelia rakudo-moar 81d173: OUTPUT«Use of Nil in string context  in code  at /tmp/fUrNgIJEki:1␤Use of Nil in string context  in code  at /tmp/fUrNgIJEki:1␤Use of Nil in string context  in code  at /tmp/fUrNgIJEki:1␤OH ␤»
02:53 AlexDaniel m: $_ = "OH 819"; s:g/(\d)/$0/; .say;
02:53 camelia rakudo-moar 81d173: OUTPUT«OH 819␤»
02:53 AlexDaniel so it does not work in "for", otherwise it is ok
02:55 AlexDaniel someone has to report that
02:55 AlexDaniel but don't think that I can find the right words for this...
02:57 [Sno] joined #perl6
03:00 aborazmeh joined #perl6
03:00 aborazmeh joined #perl6
03:00 ponbiki joined #perl6
03:06 Hor|zon joined #perl6
03:19 amurf joined #perl6
03:34 dalek rakudo-star-daily: 439729b | coke++ | log/ (8 files):
03:34 dalek rakudo-star-daily: today (automated commit)
03:34 dalek rakudo-star-daily: review: https://github.com/coke/rakudo-star-daily/commit/439729b7b6
03:34 dalek perl6-roast-data: 83daaee | coke++ | / (9 files):
03:34 dalek perl6-roast-data: today (automated commit)
03:34 dalek perl6-roast-data: review: https://github.com/coke/perl6-roast-data/commit/83daaeefbf
03:51 vendethiel joined #perl6
03:52 ugexe m: $_ = "OH 817f9"; s:g/(\d){}/$0/ for $_; .say;
03:52 camelia rakudo-moar 81d173: OUTPUT«OH 999f9␤»
03:54 ugexe must initialize the newly replaced match so no warning
03:55 ugexe then the regex is just doing a global replace on \d, and the last digit is 9 so that is the last around of replacements
04:05 * ShimmerFairy still finds using s/// and friends in any way other than stuff ~~ s/// or stuff.subst() kinda weird :)
04:45 kanl m: my ( $a, $b ) = < z ab >; say $a leg $b; say $a.succ leg $b
04:45 camelia rakudo-moar 81d173: OUTPUT«More␤Less␤»
04:46 kanl i suppose this is the case in any language.
04:48 kanl is there already a "flavor" of strcmp that takes the length of string into consideration?
04:48 kanl if there's none, cmp and leg are certainly overloadable, i suppose.
04:53 vendethiel joined #perl6
04:55 Hor|zon joined #perl6
04:57 atroxaper joined #perl6
05:15 japhb .tell FROGGS Something weird is going on with -I and the REPL.  If I `perl6 -Ilib -MSomeModule -e'use-the-module()'` it works.  But if I `perl6 -Ilib -MSomeModule` and enter `use-the-module()` in the REPL, it fails.  Examining @*INC in both cases shows 'file#lib' in the first case, but not the second!
05:15 yoleaux japhb: I'll pass your message to FROGGS.
05:21 ugexe looks like the -M isnt needed to reproduce. doing 'use lib "lib"' works as well
05:39 firefish5000 joined #perl6
05:49 kaare_ joined #perl6
06:03 vendethiel joined #perl6
06:05 kurahaupo joined #perl6
06:28 vendethiel joined #perl6
06:43 ribasushi joined #perl6
06:44 Hor|zon joined #perl6
06:57 amurf joined #perl6
07:04 geekosaur joined #perl6
07:05 FROGGS joined #perl6
07:14 darutoko joined #perl6
07:15 [TuxCM] o/
07:15 yoleaux 11 Jul 2015 19:56Z <lizmat> [TuxCM]: the semicolon in $^r<legs> < 8;  is not needed
07:15 [TuxCM] (already removed)
07:22 vendethiel joined #perl6
07:25 geekosaur joined #perl6
07:26 tinyblak joined #perl6
07:30 telex joined #perl6
07:30 liztormato joined #perl6
07:32 * liztormato waves from a very busy AMS
07:33 gfldex joined #perl6
07:39 tinyblak joined #perl6
07:44 tinyblak joined #perl6
07:44 diana_olhovik joined #perl6
07:45 Hor|zon joined #perl6
07:52 geekosaur joined #perl6
07:56 vendethiel joined #perl6
07:57 [TuxCM] if I get a Callable or Routine as argument, is there an inspection method to see what is inside the Callable/Routine?
07:58 [TuxCM] $callable.introspection.perl ~~ /flubberway/ and warn "Don't use the flubber magic inside your hooks!";
07:58 [TuxCM] .perl returns "#`(Sub|94399136) ... }" or "#`(Block|124079568) ... }"
08:16 atroxaper joined #perl6
08:38 vendethiel joined #perl6
08:59 bin_005_j_j_v joined #perl6
09:09 rindolf joined #perl6
09:12 [TuxCM] test             50000    45.301    45.213
09:12 [TuxCM] test-t           50000    44.422    44.334
09:13 spider-mario joined #perl6
09:20 vendethiel joined #perl6
09:21 masak good antenoon, #perl6
09:22 laraiito joined #perl6
09:23 laraiito hello how can i install rakudo?
09:24 moritz laraiito: hi; please see http://rakudo.org/how-to-get-rakudo/
09:24 TEttinger joined #perl6
09:25 RabidGravy joined #perl6
09:27 RabidGravy marning!
09:28 tinyblak joined #perl6
09:29 [TuxCM] .tell lizmat https://github.com/Tux/CSV/commit/6f3928344e1d499509bbea4df1930da0b5372e6c
09:29 yoleaux [TuxCM]: I'll pass your message to lizmat.
09:31 [TuxCM] All tests successful.
09:31 [TuxCM] Files=25, Tests=19672, 60 wallclock secs ( 2.60 usr  0.14 sys + 152.48 cusr  1.35 csys = 156.57 CPU)
09:34 Hor|zon joined #perl6
09:48 espadrine_ joined #perl6
10:05 ppant joined #perl6
10:08 tinyblak joined #perl6
10:14 ppant_ joined #perl6
10:14 leont joined #perl6
10:17 azawawi joined #perl6
10:17 azawawi hi
10:18 ppant joined #perl6
10:18 azawawi any idea why rakudo stopped generating panda.bat after a rebootstrap?
10:24 baest_ joined #perl6
10:34 nys joined #perl6
10:42 virtualsue joined #perl6
10:45 beastd joined #perl6
10:45 xinming_ joined #perl6
10:59 vendethiel joined #perl6
11:11 AlexDaniel joined #perl6
11:16 cschwenz joined #perl6
11:16 cschwenz o/ #perl6
11:16 Psyche^_ joined #perl6
11:19 Hor|zon joined #perl6
11:26 cschwenz left #perl6
11:28 BenGoldberg joined #perl6
11:28 AlexDaniel joined #perl6
11:31 meisl joined #perl6
11:31 tinyblak joined #perl6
11:37 aborazmeh joined #perl6
11:37 aborazmeh joined #perl6
11:40 pecastro joined #perl6
11:43 rurban joined #perl6
11:47 vendethiel joined #perl6
11:52 atroxaper joined #perl6
12:24 aborazmeh joined #perl6
12:24 aborazmeh joined #perl6
12:33 BenGoldberg joined #perl6
12:35 Hor|zon joined #perl6
12:37 RabidGravy is there any notion of "write only" attributes or methods? I'm looking at a weird API that only provides functions to set some parameters (the id3tag stuff in libmp3lame if you are interested.)
12:39 timotimo you can return a Proxy from the method that returns a Failure when read from, for example
12:39 timotimo or maybe better: Empty
12:39 timotimo it often surprises people how often the FETCH part of the proxy gets called when doing seemingly harmless things
12:39 timotimo i'm not sure if FETCH will also be called when you only want to assign to, not actually read from the "attribute"
12:40 RabidGravy it did indeed suprise me :)
12:42 raiph joined #perl6
13:00 * RabidGravy does an experiment
13:01 RabidGravy yeah, or fake it up with a state variable:
13:01 RabidGravy m: class A { method f() returns Str is rw { state Str $a; Proxy.new(FETCH => sub ($) { $a; }, STORE => sub ($, $val) { $a = $val } ) } }; my $c = A.new; $c.f = "boo"; say $c.f
13:01 camelia rakudo-moar 81d173: OUTPUT«boo␤»
13:02 timotimo hmm. why do we build a new Proxy object every time anyway?
13:03 RabidGravy I don't know, but it seems to work
13:05 timotimo but that's not write-only any more :)
13:07 lichtkind joined #perl6
13:09 RabidGravy faking it also works for me ;-)
13:10 moritz m: class A { has $.f is rw; submethod BUILD() { my $a; $!f := Proxy.new(FETCH => sub (|) { $a }; STORE => sub ($, $val) { $a = $val }) } }; my $x = A.new; say $x.f; $x.f = 42; say $x.f
13:10 camelia rakudo-moar 81d173: OUTPUT«Too many positionals passed; expected 1 argument but got 3␤  in submethod BUILD at /tmp/TZoXFqXRAZ:1␤  in block <unit> at /tmp/TZoXFqXRAZ:1␤␤»
13:10 moritz m: class A { has $.f is rw; submethod BUILD(|) { my $a; $!f := Proxy.new(FETCH => sub (|) { $a }; STORE => sub ($, $val) { $a = $val }) } }; my $x = A.new; say $x.f; $x.f = 42; say $x.f
13:10 camelia rakudo-moar 81d173: OUTPUT«Too many positionals passed; expected 1 argument but got 3␤  in submethod BUILD at /tmp/ycYqOn9kbB:1␤  in block <unit> at /tmp/ycYqOn9kbB:1␤␤»
13:11 moritz m: class A { has $.f is rw; submethod BUILD(|) { my $a; $!f := Proxy.new(FETCH => sub (|) { $a }, STORE => sub ($, $val) { $a = $val }) } }; my $x = A.new; say $x.f; $x.f = 42; say $x.f
13:11 camelia rakudo-moar 81d173: OUTPUT«(Any)␤42␤»
13:17 aborazmeh joined #perl6
13:17 aborazmeh joined #perl6
13:19 tinyblak joined #perl6
13:48 BenGoldberg Maybe there should be some sort of syntactic sugar for creating a Proxy which will be reused?
13:54 nnms joined #perl6
14:07 RabidGravy moritz, yeah I like that one but I think my actual code would have to be more like:
14:07 RabidGravy m: use NativeCall; class A is repr("CPointer") { my $f; my Str $a; method f() returns Str is rw { $f }; submethod BUILD() { $f = Proxy.new(FETCH => sub ($) { $a; }, STORE => sub ($, $val) { $a = $val } )  } }; my $c = A.new; $c.f = "boo"; say $c.f
14:07 camelia rakudo-moar 81d173: OUTPUT«boo␤»
14:07 RabidGravy because CPointer
14:10 RabidGravy and then I'd start wanting to insert the lexicals dynamically because there are a bunch of these and I'd want to do it with a trait and It would all start going downhill rather rapidly ;-)
14:14 RabidGravy ah, no wait
14:24 molaf joined #perl6
14:24 Hor|zon joined #perl6
14:26 nightfrog joined #perl6
14:40 verzz joined #perl6
14:43 verzz joined #perl6
14:49 colomon joined #perl6
14:51 rindolf joined #perl6
15:06 ugexe you are suppose to bind to the Proxy
15:10 danaj joined #perl6
15:10 vendethiel joined #perl6
15:10 khw joined #perl6
15:20 RabidGravy ugexe, yep but in the kind of CPointer classes I'm dealing with there b'ain't nowhere to bind the Proxy
15:29 atroxaper joined #perl6
15:40 BenGoldberg joined #perl6
16:00 ugexe ah. i did not know you could not have attribute storage with the CPointer classes
16:02 RabidGravy yeah, it's kind of weird because it'll let you define the class like that only to crap out when you instantiate it
16:10 Hor|zon joined #perl6
16:11 vendethiel joined #perl6
16:14 tinyblak joined #perl6
16:21 verzz joined #perl6
16:26 lucasb joined #perl6
16:35 lucasb This ticket about executing a directory as a script name made me remember that rakudo doesn't know how to read named pipes
16:36 lucasb perl6 <(echo say 42)
16:36 lucasb perl6 -e 'say @*ARGS.shift.IO.slurp' <(echo hi)
16:41 kaare_ joined #perl6
16:51 RabidGravy lucasb, you *can* but it's a PITA: perl6 -e 'say @*ARGS.shift.IO.open(:bin).read(10).decode' <(echo hi)
16:51 kaare_ joined #perl6
16:51 RabidGravy same with any "special" file that it can't tell the size of up-front
16:54 lucasb RabidGravy: cool. I didn't know about that. Thanks
16:58 RabidGravy It's somewhat less than fabulous, but if it was a  common enough pattern you could stick it in a module or augment IO::Path or something
17:15 skids joined #perl6
17:22 adu joined #perl6
17:23 araujo_ joined #perl6
17:27 [Sno] joined #perl6
17:30 rindolf joined #perl6
17:37 dylanwh joined #perl6
17:43 lichtkind joined #perl6
17:47 FROGGS joined #perl6
17:48 molaf_ joined #perl6
17:50 telex joined #perl6
17:50 amurf joined #perl6
17:59 Hor|zon joined #perl6
18:21 spider-mario joined #perl6
18:25 raiph joined #perl6
18:46 domidumont joined #perl6
18:50 dalek DBIish: d8caa54 | lembark++ | .gitignore:
18:50 dalek DBIish: ignore editor cruft
18:50 dalek DBIish: review: https://github.com/perl6/DBIish/commit/d8caa54a0c
18:50 dalek DBIish: 8b3eb92 | lembark++ | t/ (3 files):
18:50 dalek DBIish: use PG environment variables to configure connection; update POD to avoid user having to pre-create hardwired database and user
18:50 dalek DBIish: review: https://github.com/perl6/DBIish/commit/8b3eb928ce
18:53 tinyblak joined #perl6
18:56 zakharyas joined #perl6
19:00 ggoebel joined #perl6
19:05 atroxaper joined #perl6
19:08 rurban joined #perl6
19:23 dalek rakudo/nom: 7b65907 | (Nick Logan)++ | src/core/CompUnitRepo/Local/Installation.pm:
19:23 dalek rakudo/nom: bin/basename postfix loop flattening
19:23 dalek rakudo/nom:
19:23 dalek rakudo/nom: Fixes generating bin/ files
19:23 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/7b6590799e
19:23 dalek rakudo/nom: 2e612ac | FROGGS++ | src/core/CompUnitRepo/Local/Installation.pm:
19:23 dalek rakudo/nom: Merge pull request #467 from ugexe/patch-10
19:23 dalek rakudo/nom:
19:23 dalek rakudo/nom: bin/basename postfix loop flattening
19:23 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/2e612acc29
19:34 meisl joined #perl6
19:34 meisl hello #perl6
19:36 RabidGravy coo, another Sunday another patch for a twenty year old perl 5 module
19:36 TEttinger joined #perl6
19:37 RabidGravy but hey! I got a patch from a debian packager :-)
19:38 atweiden joined #perl6
19:45 brrt joined #perl6
19:48 Hor|zon joined #perl6
19:52 atweiden i'm having an issue with piping grep results to .map that i don't know how to debug
19:53 atweiden i have a hash that looks like this: https://gist.github.com/atweiden/fa517c1759bd83649ad9#file-buckets-p6-L74
19:53 atweiden when part of this hash is grep'd for PostingUUIDBalanceDelta < 0, there are two results:
19:53 atweiden [DEBUG] %balance_delta_by_posting_uuid.grepped (UUID.new(bytes => Buf[uint8].new(111, 181, 100, 39, 223, 191, 71, 97, 129, 161, 204, 111, 4, 189, 161, 89), version => 4) => -24.0, UUID.new(bytes => Buf[uint8].new(37, 20, 99, 73, 34, 100, 69, 86, 145, 199, 55, 38, 149, 12, 199, 71), version => 4) => -24.0)
19:53 atweiden but when I pipe %balance_delta_by_posting_uuid.grep to .map, here: https://gist.github.com/atweiden/fa517c1759bd83649ad9#file-buckets-p6-L116
19:53 atweiden there is no output, and no buckets are instantiated
19:59 meisl brrt: thx for hinting at Aho paper on Tree matching, it's a great inspiration for me (http://site.iugaza.edu.ps/hzaq/files/2010/02/Code_generation_using_tree_matching_and_dynamic_programming,.pdf)
19:59 brrt you're welcome meisl :-)
20:00 brrt what are you trying to do with it?
20:00 ilbelkyr joined #perl6
20:01 meisl :) well, I was thinking of implementing it, in p6 or nqp, and continued thinking of how to implement it in a purely functional way
20:02 meisl brrt: guess you're gonna implement it in C, for the JIT stuff?
20:02 brrt yes. actually, the aho paper mentions a preprocessor
20:03 meisl hmm, but the preprocessor stuff isn't really crucial, IMHO. Just to get the "prologue" stuff from the patterns in
20:04 brrt since i'm already knee-deep in preprocessor-land
20:04 brrt i might do that as well :-)
20:04 brrt i'm not 100% sure on how to do it, though
20:04 meisl do what as well?
20:05 hoelzro could someone explain to me how to unpack a nested list in a for loop parameter? my attempt is https://gist.github.com/hoelzro/ab8b7df7f225b71b1f17, but it's not working, and I'm wondering if it's because of GLR stuff
20:05 meisl (write a preprocessor?...)
20:05 atweiden issue resolves itself with for %h.kv -> ... https://gist.github.com/atweiden/fa517c1759bd83649ad9#file-buckets-fixed-with-for-kv-p6-L118
20:05 brrt well, the way i understand it, they build pattern matching tables at compile time? i think i might do that. preprocessing has worked out nicely enough in the moarvm - to - expression-tree - translation
20:07 brrt but to be totally blunt, i'm not that far yet
20:08 bin_005 joined #perl6
20:08 meisl well, I'd say they build a tree matching automaton from their "twig" specs (which'd be a "slang" or else some p6 OO API). This then is *run* on an actual tree (QAST for me, MAST for you)
20:09 meisl so yes, the step from twig spec to automaton is a compilation
20:09 brrt i'm actually working below the MAST level
20:10 meisl oh, what is it then?
20:10 brrt well, long story short
20:10 brrt i use an IR with a (virtual) register model
20:11 meisl so you first translate MAST to that IR and only on that you'd do the tree-matching in order generate machine code?
20:11 brrt i call it the 'expression tree', which is misnomer because it's a DAG that contains statements ^^
20:11 brrt actually, it's deeper than that still
20:12 meisl sure
20:12 brrt i use the spesh graph, which is the internal representation used for 'spesh' optimizations
20:12 meisl i c
20:12 brrt spesh stands for, among other thing, type specialisation
20:12 brrt but it does also other things like inlining
20:13 brrt from that spesh graph we compile the expression tree, per basic block, from per-instruction templates
20:13 meisl "templates" as in the Aho paper?
20:14 meisl (since these aren't necessarily "per-instruction")
20:14 brrt no, this is just for the translation from moarvm bytecode to the IR presentation, so those are per instruction
20:15 brrt these templates represent little tree structures which are pasted in to make a big structure
20:15 brrt this tree structure is then iterated over
20:15 brrt during that iteration, i suppose the tree-matching automaton is supposed to run
20:16 lucasb hoelzro: for @a -> ($first, *@rest) { ... }  # but 'for @a -> [...] {}' also work
20:16 brrt but before that, and using in principle the same iteration mechanisms, i aim to do live range calculations, possibly (local) register allocation, common subexpression elimination
20:16 hoelzro huh, I could've sworn that using () would take more than one value from the top level list
20:16 hoelzro lucasb: thanks!
20:17 brrt for most of these things, i know how to do them; for the automaton, i do not (totally)
20:18 meisl yes, it's a really smart combination of things smart in themselves already
20:19 brrt that is true in general of compiler stuff :-)
20:19 brrt also precisely what makes it a bit tricky
20:20 meisl why not use the same concept all the way thru, ie use (a variant of) such an automaton for the mbv -> IR step as well?
20:20 meisl (mbc, moar bytecode, -> IR)
20:21 brrt basically, because moar bytecode lives on a higher level
20:22 meisl it's still a tree, isn't it?
20:22 brrt the way i see it, the aho tree-matching algorithm is moving from a lower level (each and every load, address calculation, store, etc explicit) to a higher level
20:23 brrt thus, a tile represents multiple steps in the IR
20:24 brrt on the other hand, the moarvm -> expression tree translation represents a lowering; a moarvm-level operation is translated into machine-level operations
20:25 brrt for the first thing, you want to find the best way to split a tree into fewer (larger) pieces; for the last thing, you want to expand a single piece into multiple smaller pieces
20:25 meisl well, it has several aspects I think. for 1 it let's you rewrite trees while abstracting away the actual recursion and also a good portion of the matching
20:25 brrt the goal is to find the commonality between the various operations that moarvm bytecode cannot represent
20:26 brrt (the commonality, that is)
20:26 meisl another aspect is the dynamic programming, that is the "auto-optimization" that is kinda built-in (sorry, can't put it in a better right now)
20:27 meisl it is not, however, tied to one particular level, IMHO
20:28 brrt hmm
20:29 brrt ok, let me put it this way
20:29 brrt when you translate a tree, you can either move up, down or stay at the same level of representation
20:30 meisl hmm, let's say "level of abstraction", ok?
20:30 brrt moving up means the nodes of the output represent larger parts of the input, moving down means the input is represented in multiple parts of the output
20:30 brrt right
20:31 brrt s/the input is represented in/each node in the input is represented as/
20:32 brrt potentially, yes, i could represent two related input nodes (moarvm instructions) as a single IR-level template
20:32 meisl but it's not as simple as just "more nodes in tree", right?
20:32 brrt well, it's much simpler if you either expand or shrink, not do both at the same time :-)
20:32 meisl (going down, that is)
20:33 brrt and moreover, any and all relations between the two moarvm instructions will still be present in the lower-level representation
20:34 brrt if they've become obscured, that probably means their relation wasn't that strong to begin with
20:34 meisl sure, it must have the same semantics (= effect)
20:34 meisl (or maybe I didn't understand "relation" properly...?)
20:35 brrt so it's not entirely obvious to me what the benefit would be of matching multiple moarvm instructions as a unit to a set of expression tree operations
20:35 brrt no, i think we both have the same idea :-)
20:36 meisl ok, maybe we should have a (really) small example of mbc -> IR?
20:37 brrt oh, sure, take a look at
20:38 brrt https://github.com/MoarVM/MoarVM/blob/even-moar-jit/src/jit/exprlist
20:38 brrt these are the templates in s-expr format
20:38 meisl (studying)
20:39 brrt e.g. add_i translates to (add $1 $2) - the translator takes the $1 and $2 moarvm instruction operands, and converts them to the register-model
20:39 brrt i.e. inserts loads (if needed)
20:42 brrt decommute &
20:42 brrt left #perl6
20:46 FROGGS .tell jnthn I think MVMExceptionBody needs an MVMObject *label, so the payload can be used for: LABEL.leave(42)
20:46 yoleaux 05:15Z <japhb> FROGGS: Something weird is going on with -I and the REPL.  If I `perl6 -Ilib -MSomeModule -e'use-the-module()'` it works.  But if I `perl6 -Ilib -MSomeModule` and enter `use-the-module()` in the REPL, it fails.  Examining @*INC in both cases shows 'file#lib' in the first case, but not the second!
20:46 yoleaux FROGGS: I'll pass your message to jnthn.
20:47 meisl brrt: ?
20:51 meisl FROGGS: sorry to bother you - how about an Windows .msi for Rakudo* 2015.06?
20:51 FROGGS meisl: yes, seen your gh issue... will do that tomorrow evening
20:52 meisl woow, great! :D++
20:54 adu joined #perl6
20:57 FROGGS :o)
20:59 colomon joined #perl6
20:59 meisl still haven't managed to get smart/knowlegdeable enough to build it on my own...
21:03 japhb FROGGS: Any idea why the REPL is special WRT -I?
21:04 FROGGS japhb: not yet, and need to shutdown my laptop now :o(
21:04 japhb Ah, fair enough.
21:04 FROGGS see you tomorrow
21:04 geekosaur scope?
21:05 japhb geekosaur: Meaning the REPL's outer scope isn't being set properly?
21:06 geekosaur Haven't we had a number of problems of that sort, where the scope of the REPL isn't what something else expects?
21:06 geekosaur not that I am familiar with any of that code
21:08 lizmat joined #perl6
21:09 * lizmat waves from PDX
21:09 yoleaux 09:29Z <[TuxCM]> lizmat: https://github.com/Tux/CSV/commit/6f3928344e1d499509bbea4df1930da0b5372e6c
21:09 * vendethiel wave at lizmat
21:10 lizmat vendethiel o/
21:10 colomon joined #perl6
21:10 ugexe japhb: looks like it doesnt process any compiler options
21:10 ugexe perl6 --ll-exception -e 'die' is another example
21:10 japhb o/ lizmat
21:11 japhb ugexe: Oh, hmmm.  That's fairly broken, methinks.
21:11 japhb Anyone remember why that (lack of) behavior was chosen?
21:13 meisl *meisl tries out third-person-thingy
21:13 meisl ...and fails
21:15 raiph joined #perl6
21:19 geekosaur "/me ..."
21:19 geekosaur that youc lient displays it with a leading * isn't what is significant (look carefully at where the "*" is...)
21:22 ggoebel2 joined #perl6
21:25 * meisl thanks geeosaur
21:26 * meisl apologizes & thanks gee*k*osaur
21:28 amurf joined #perl6
21:28 * BenGoldberg wonders what a geeosaur would be.  Prehistoric clarified butter?
21:28 BenGoldberg Oh wait, that's ghee.  Nevermind.
21:29 brrt joined #perl6
21:32 japhb BenGoldberg: That was before the 'h' was added.
21:33 japhb Maybe it's a prehistoric teenager that says "Gee, ya think?!" all the time.
21:37 Hor|zon joined #perl6
21:39 brrt \o
21:40 brrt meisl: had to leave the train, sorry :-)
21:40 Juerd joined #perl6
21:40 meisl np, hello back :)
21:42 skids .oO(a flock of pink flamingos can peck a gheeosaur clean in under 30 seconds)
21:42 yoleaux 11 Jul 2015 11:55Z <timotimo> skids: moritz is keeping https://github.com/moritz/perl6-all-modules
21:42 meisl brrt: gave me a while for meditation - but, to be honest, it's quite a bit to grok for me...
21:42 brrt ok, which point do you want to know
21:44 meisl ok, 1st: I can kinda guess "template: " but what's "macro: "?
21:47 Juerd joined #perl6
21:50 brrt macro: defines a macro in the template preprocessor; it defines a tree that is spliced - with some arguments - directly into the templates in which it is used
21:51 brrt for example, p6obody calculates the address of the body of a MVMP6opaque object
21:51 brrt this is used in multiple different instruction templates
21:55 meisl brrt: so eg the p6obody macro is used in the template (matching?) sp_p6ogetvt_o?
21:55 meisl (used/expanded)
21:55 * lizmat tries to stay awaek
21:56 lizmat *awake  (there you go)
21:56 brrt yes,
21:56 brrt :-)
21:56 brrt it's sunday evening nearly 12 o clock
21:56 lizmat japhb: what (lack of) behaviour are we talking about
21:56 brrt i'm only awake because of memory corruption :-P
21:56 lizmat brrt: almost 3pm here in Portland
21:56 brrt hmmm
21:56 lizmat and I'm only awake because I should be  :-)
21:56 brrt also a good time for a nap :-)
21:57 lizmat I'm afraid a nap will bring me to 9pm or so... and then I'm really floating in time
21:58 brrt time is relative :-)
21:58 meisl brrt: it's rather late over here as well, so... - you choose
21:58 brrt i can explain more if you wish :-)
21:58 brrt are you familiar with lisp/scheme?
21:58 meisl ok fine, thx
21:59 meisl let's take the ^func macro instead, it looks less intimidating
22:00 brrt let's
22:01 brrt hmmm
22:01 meisl am I right in that "^func" does NOT map to an mbc node, whereas the thing after a "template:" does?
22:01 brrt the if in p6obody should be an ifelse, or i should rename ifelse to if and rename the single if to something else
22:02 brrt yes, that is exactly right
22:03 brrt the ^func macro translates to a constant node with as first argument the name of the function referenced and as second argument the pointer size
22:03 brrt a constant node has no children, just arguments, the constant in question and the size of it
22:03 brrt in bytes
22:03 meisl ...translates to an *IR* node, right?
22:03 brrt ptr_sz expands to MVM_JIT_PTR_SZ which is defined as sizeof(void*)
22:03 brrt yes, an IR node
22:04 meisl ok, now I'm trying to understand the template for "say": it references the ^func in its s-expr
22:04 brrt so for instance, in the template for say, it expands to (const (&CONST_PTR MVM_string_say) ptr_sz)
22:04 meisl :)
22:05 brrt the &foo syntax is somewhat special, it expands to a C-level macro (or 'function call')
22:05 brrt like sizeof() and offsetof() and ALIGNOF etc
22:05 brrt e.g. (&foo bar baz) yields foo(bar,baz)
22:06 brrt the CONST_PTR macro simply casts the given pointer to uintptr_t, which is 64 bits, and fits into a single IR node
22:07 meisl so I can read the template for "say" just as if "^func" was literally replaced by "(const (&CONST_PTR ,a) ptr_sz))", with an appropriate ",a" (just textual substitution, preprocessor-like)?
22:07 brrt hmm, yes, somewhat; it's actually AST-level substitution ,but it comes to the same thing
22:09 meisl yeah, sure. "textual" isn't quite appropriate
22:09 brrt it's indeed just spliced in
22:09 brrt without such a macro, jit expressions become really unwieldy very fast
22:10 brrt these lists are compiled to a linear array that represents the tree by using (relative) indices
22:11 brrt relative to the start of  the list, that is
22:11 meisl ok ok. but actually it appears to me that the Aho alg already supports this kind of "splicing in", you know
22:12 meisl that is, I think you do not need to reproduce it by introducing the separation between "macro:" and "template:" yourself
22:13 meisl (and thereby - if I'm right - need no extra preprocessor)
22:15 brrt hmmm
22:15 brrt i'm not sure we're talking about the same thing, now
22:16 brrt the way i understand the aho/johnson algorithm is that the input is a tree, the output is a set (list) of 'tiles' that cover the tree, and the trick is to find an 'optimal' covering
22:16 brrt whereby optimal typically means 'with the lowest possible memory usage/register usage/instruction count
22:17 brrt and it does this by bottom-up matching the tree to certain patterns
22:17 brrt fine; but the problem the exprlist compiler solves is a different one
22:17 brrt the input is a basic block of moarvm instructions; that is, a linear sequence
22:18 brrt the output should be a graph of machine-level operations that encodes the relationship between values
22:19 brrt these relationships are encoded simply by linking from use to definition
22:19 meisl not sure either :) - anyways, I think it's got even more: a) matching against *complex* subtree patterns (written as s-expr, btw), b) the ability to rewrite the subject tree and re-visit it again and c) as a "side-effect", emit "tiles" (actual code-gen)
22:21 meisl additionally, one can switch at will from bottom-up to top-down, anywhere in the subject tree
22:23 meisl ...as I said, very clever combination of very cleverly crafted pieces - and all under the assumption that I didn't get the paper completely wrong... :)
22:24 brrt hmmm, i don't think you got it wrong
22:24 meisl at least not completely.. I hope
22:24 brrt or, not entirely at least :-)
22:27 meisl as you mention again "linear sequence" vs "relationship between values" - we're still talking about a *tree" repr of the moarvm instructions, aren't we?
22:28 brrt if you ask complex questions, you'll get complex answers
22:29 meisl sure :)
22:29 brrt the spesh graph is basically a control-flow-graph (a graph of basic blocks)
22:30 brrt spesh basic blocks contain linked lists of instructions
22:31 brrt instructions are annotated with facts, that come from logging, and operands are ssa-namespaced, meaning that every value has a unique ssa-definition-name
22:31 meisl ssa?
22:31 brrt single static assignment
22:31 meisl ok
22:33 brrt it's a long story; the point is that these ssa-names implicitly define a tree, but that i disregard that information (for now)
22:33 brrt and that i make the implicit tree explicit
22:33 meisl sorry if it's a dump q: so with the spesh graph we've already taken then step from *expressions* ("functional") to "procedural"?
22:34 meisl ("procedural" meaning the explicit instructions how to calculate the expression)
22:34 brrt actually, the other way arround; the moarvm bytecode is procedural; the spesh graph makes it somewhat-functional (SSA) and the expression tree compiler (builder) makes it 'functional' in a way different from the way spesh does it
22:35 meisl oh
22:36 cognominal If I have a variable (really a constant) specifying a signature, is it possible to use it to specify a subsignature in a signature?
22:37 brrt compared to the moarvm bytecode, the expr tree achieves two things
22:38 brrt a): it translates from a memory-to-memory model (from the inteprreter) to a register-to-register model, thereby making loads and stores explicit
22:38 brrt b): it links use directly to definition
22:39 kurahaupo joined #perl6
22:39 brrt both of these together allow a code generator to make decisions on how to calculate something based both on where it's coming from and on how it will be used
22:39 meisl brrt: I'm afraid I need a break from the details
22:39 brrt very well
22:40 brrt i need a break from not sleeping
22:40 brrt :-)
22:41 brrt i'll be here tomorrow if you still have questions
22:41 atroxaper joined #perl6
22:41 brrt see you!
22:41 meisl cool, I definitely will
22:49 japhb .tell lizmat I was referring to the fact that perl6's command line options don't seem to affect the REPL (or at least, not all of them).  In my particular class, -I wasn't affecting @*INC in the REPL, and ugexe seemed to indicate --ll-exception was problematic as well.
22:49 yoleaux japhb: I'll pass your message to lizmat.
22:50 cognominal ok, found a way out. :)
22:50 japhb cognominal: Do tell.  :-)
23:17 amurf joined #perl6
23:26 Hor|zon joined #perl6
23:28 jferrero joined #perl6
23:29 dayangkun joined #perl6
23:31 ugexe win32 jvm is splitting the volume off somewhere while generating the path-spec. All but first file spec are like this: ["file#C", "file#\\Users\\Nick\\Documents\\p6\\jvm\\install\\share\\perl6\\runtime"]
23:31 ugexe ^ say @*INC
23:34 cognominal japhb: the answer to the stated part of my question which is vaster than I explained  is in S02   :  my ::MySig ::= :(Int, Num, Complex, Status)
23:34 cognominal then I can use MySig.
23:35 camelia joined #perl6
23:35 arnsholt joined #perl6
23:36 broquaint joined #perl6
23:38 cognominal jahpb, I want to do a custom &run sub to which I can pass pairs to represent switches. I don't want these pairs to collide with the ones passed to Proc.
23:43 cognominal m:      my ::MySig ::= :(Int, Num, Complex)
23:43 camelia rakudo-moar 2e612a: OUTPUT«5===SORRY!5=== Error while compiling /tmp/YfaJRuhqIq␤Cannot use :: as a type name␤at /tmp/YfaJRuhqIq:1␤------> 3my ::MySig ::7⏏5= :(Int, Num, Complex)␤»
23:44 cognominal hum, does not work as is :(
23:45 cognominal m:      my ::MySig := :(Int, Num, Complex)
23:45 camelia rakudo-moar 2e612a: OUTPUT«5===SORRY!5===␤Type 'MySig' is not declared␤at /tmp/xKlqivSftS:1␤------> 3my ::MySig 7⏏5:= :(Int, Num, Complex)␤Malformed my␤at /tmp/xKlqivSftS:1␤------> 3my ::MySig 7⏏5:= :(Int, Num, Complex)␤␤»
23:50 cognominal probably need to sleep on that
23:55 dalek rakudo-star-daily: 2fb84ef | coke++ | log/ (8 files):
23:55 dalek rakudo-star-daily: today (automated commit)
23:55 dalek rakudo-star-daily: review: https://github.com/coke/rakudo-star-daily/commit/2fb84efb00
23:55 dalek perl6-roast-data: 2206c92 | coke++ | / (9 files):
23:55 dalek perl6-roast-data: today (automated commit)
23:55 dalek perl6-roast-data: review: https://github.com/coke/perl6-roast-data/commit/2206c925c2

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

Perl 6 | Reference Documentation | Rakudo