Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-08-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:03 BenGoldberg joined #perl6
00:12 mcmillhj joined #perl6
00:12 mr-foobar joined #perl6
00:12 ckraniak joined #perl6
00:23 AlexDaniel huggable: The Hundred-Year Language
00:23 huggable AlexDaniel, nothing found
00:24 AlexDaniel huggable: The Hundred-Year Language :is: http://www.paulgraham.com/hundred.html
00:24 huggable AlexDaniel, Added The Hundred-Year Language as http://www.paulgraham.com/hundred.html
00:28 mcmillhj joined #perl6
00:35 mr-foobar joined #perl6
00:38 pierre_ joined #perl6
00:41 mcmillhj joined #perl6
00:49 Geth ¦ ecosystem: 2429b032f1 | (David Warring)++ | META.list
00:49 Geth ¦ ecosystem: add PDF::API6 - General purpose PDF librARY (WIP)
00:49 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/2429b032f1
01:02 mr-foobar joined #perl6
01:05 Geth ¦ ecosystem: f88f36bfe1 | (David Warring)++ | META.list
01:05 Geth ¦ ecosystem: fix PDF::API6 url
01:05 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/f88f36bfe1
01:08 tyil joined #perl6
01:14 mcmillhj joined #perl6
01:19 Todd_ joined #perl6
01:19 Todd_ May I mooch some help with a one liner?  http://vpaste.net/WoTgJ
01:22 ugexe map is not grep
01:24 Todd_ I dumb dumb   how would you do it ina one liner?
01:25 Todd_ This is what I am trying to replace:
01:25 Todd_ Device=$(ls -al /dev/disk/by-partlabel | sed -e 's/-//g' | awk '{print $9, " " $11}' | grep -i "lin-bak" | awk -F "../../" '{print $2}')
01:32 mr-foobar joined #perl6
01:32 mcmillhj joined #perl6
01:33 raschipi I got this so far:
01:33 raschipi m: ls -al /dev/disk/by-label/ |perl6 -e '.say for lines.map(*.split(" ")).map(*.[9,11])
01:33 camelia rakudo-moar 5fcce6: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Two terms in a row?at <tmp>:1?------> 3ls -al /dev/7?5disk/by-label/ |perl6 -e '.say for lines?    expecting any of:?        infix?        infix stopper?        postfix?        statemen…»
01:33 Todd_ a better one
01:33 Todd_ ls -al /dev/disk/by-partlabel |  grep -i "lin-bak" | awk '{print  $11}' | sed -e 's/..\/..\///'
01:34 entonian joined #perl6
01:50 Todd_ I got it, but it is a bit long and weird:
01:50 Todd_ ls -al /dev/disk/by-partlabel | /usr/bin/perl6 -e 'my @x=lines; for ( @x ) -> $y {if ( $y ~~ /"lin-bak"/ ) { (my $z = $y ) ~~ s|.*"../../"||; say "$z"}}'
01:50 Todd_ ls -al /dev/disk/by-partlabel | /usr/bin/perl6 -e 'my @x=lines; for ( @x ) -> $y {if ( $y ~~ /"lin-bak"/ ) { (my $z = $y ) ~~ s|.*"../../"||; say "$z"; last}}'
01:50 raschipi m: use MONKEY-GUTS;my @l = "/dev/disk/by-label/".lines.map(*.IO.dir.Str);say nqp::readlink $_ for @l
01:50 camelia rakudo-moar 5fcce6: OUTPUT: «Failed to get the directory contents of '/dev/disk/by-label': Failed to open dir: 2?  in whatevercode  at <tmp> line 1?  in block <unit> at <tmp> line 1??»
01:51 ilbot3 joined #perl6
01:51 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:54 Marks joined #perl6
01:57 araraloren ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for lines[1..*]'
02:00 Todd_ how do I get rid of the leading space?
02:08 noganex joined #perl6
02:09 mcmillhj joined #perl6
02:09 cdg joined #perl6
02:22 araraloren Todd_, .trim
02:22 mcmillhj joined #perl6
02:24 BenGoldberg joined #perl6
02:25 Todd_ where do I put the trim?
02:27 araraloren Hmm, before the result print
02:29 Todd_ ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).say for trim.lines[1..*]'
02:29 Todd_ doesn't work
02:30 araraloren ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).trim.say for lines[1..*]'
02:30 dubi0us joined #perl6
02:30 araraloren This should work
02:30 Todd_ ls /dev/disk/by-partlabel -Al | perl6 -e '.words.[* - 1].match(/s\w+$/).trim.say for lines[1..*]' sdd1
02:30 Todd_ Thank you!
02:31 mr-foobar joined #perl6
02:31 Geth ¦ doc: 72607fab64 | (Will "Coke" Coleda)++ | doc/Type/Iterable.pod6
02:31 Geth ¦ doc: remove trailing whitespace
02:31 Geth ¦ doc: review: https://github.com/perl6/doc/commit/72607fab64
02:37 mcmillhj joined #perl6
02:47 dubi0us_ joined #perl6
02:50 hythm_ joined #perl6
02:53 mcmillhj joined #perl6
02:56 dubi0us joined #perl6
02:58 dubi0us_ joined #perl6
02:58 raschipi m: my $i = 3.2/500; my @a = 1,(* × (1 + $i))...?; say 500 * @a[18] #Neat!
02:58 camelia rakudo-moar 5fcce6: OUTPUT: «560.843008310062?»
03:01 ckraniak FormatMessage now working, pointers confirmed for sucking in every language
03:04 raschipi Perl6 doesn't have pointers, yay.
03:06 ckraniak ... well I've been dealing with native call
03:06 ckraniak But now that it works I know the incantation!
03:07 raschipi Are you happy with the way P6 does it?
03:11 ckraniak It's ok. Half the trouble is needing to prod and see if Windows will take a CArray[uint16] in LPTSTR places vs a Str is rw or whichever
03:11 mcmillhj joined #perl6
03:12 ckraniak Learning you have to explicitly make a void pointer instead of passing in 0
03:13 ckraniak I haven't even tried the DWORD_PTR array part yet
03:14 dubi0us joined #perl6
03:17 Cabanossi joined #perl6
03:17 ckraniak I like Perl 6 in general a lot though
03:18 dubi0us joined #perl6
03:21 BenGoldberg ckraniak, You don't have to pass, say, Pointer[void] specificially -- you could just pass in Pointer.
03:28 araraloren you can replace CArray[uin8] with buf16
03:28 dubi0us joined #perl6
03:30 mcmillhj joined #perl6
03:36 brabo left #perl6
03:40 wamba joined #perl6
03:41 dubi0us joined #perl6
03:50 ckraniak The other thing this could use is more examples of what I've done here
03:51 ckraniak Not something I could find on stackoverflow, or github etc. else I wouldn't be bugging y'all
03:53 pharv_ joined #perl6
04:00 araraloren ckraniak, what are trying to do ?
04:01 ckraniak WinAPI garbage. Hit of a language learning exercise
04:01 geekosaur joined #perl6
04:01 ckraniak s/hit/bit/
04:02 mcmillhj joined #perl6
04:03 raschipi ckraniak: NativeCall does lack documentation. I think they didn't went all out about it because most of this stuff isn't finalized yet.
04:03 mr-foobar joined #perl6
04:04 araraloren yeah, should do some dig use NativeCall before write real code
04:11 wamba joined #perl6
04:17 mcmillhj joined #perl6
04:37 mcmillhj joined #perl6
04:47 Cabanossi joined #perl6
04:50 mcmillhj joined #perl6
04:52 dubi0us joined #perl6
04:54 dubi0us_ joined #perl6
05:06 wigner joined #perl6
05:21 mcmillhj joined #perl6
05:38 llfourn_ joined #perl6
05:46 pierre_ joined #perl6
05:46 mcmillhj joined #perl6
05:54 haha_ joined #perl6
06:04 mr-foobar joined #perl6
06:05 mcmillhj joined #perl6
06:09 dubi0us joined #perl6
06:18 mcmillhj joined #perl6
06:20 pharv joined #perl6
06:20 aborazmeh joined #perl6
06:20 aborazmeh joined #perl6
06:26 dubi0us joined #perl6
06:27 coetry joined #perl6
06:27 coetry What is recommended if I want to see step by step how perl6 code is being executed? Something like a call stack or something. Like I want to see it all layed out.
06:28 coetry I'm in the repl and trying to do an html dump from Data::Dump::Tree::DHTML, and it seems that its hanging when trying to dump an XML node
06:30 coetry the xml file is 6499 lines and I slurped it all up in a single scalar
06:36 mcmillhj joined #perl6
06:49 dubi0us joined #perl6
07:02 Cabanossi joined #perl6
07:05 mcmillhj joined #perl6
07:10 ChoHag joined #perl6
07:11 nadim joined #perl6
07:13 lisbeth joined #perl6
07:13 lisbeths left #perl6
07:22 pharv_ joined #perl6
07:28 raschipi joined #perl6
07:29 darutoko joined #perl6
07:31 imcsk8 joined #perl6
07:33 renormalist joined #perl6
07:35 renormalist DrForr_: is the module from your talk about parsing Perl6 with Perl6 (which gave detailed character positions of symbols etc) online somewhere?
07:36 gfldex renormalist: https://github.com/drforr/perl6-Perl6-Parser
07:36 mcmillhj joined #perl6
07:37 imcsk8 joined #perl6
07:37 renormalist gfldex: thanks!
07:38 pierre_ joined #perl6
07:49 dubi0us joined #perl6
07:55 dubi0us joined #perl6
07:57 pmurias joined #perl6
07:57 * pmurias is back home after TPC::EU
07:58 mcmillhj joined #perl6
08:02 Cabanossi joined #perl6
08:04 mr-foobar joined #perl6
08:08 pierre_ joined #perl6
08:10 dubi0us joined #perl6
08:10 mcmillhj joined #perl6
08:15 Geth ¦ Inline-Perl5: 04a774ccf8 | (Stefan Seifert)++ | lib/Inline/Perl5.pm6
08:15 Geth ¦ Inline-Perl5: Speed up invoke-args a tiny bit by using a lower level type check
08:15 Geth ¦ Inline-Perl5:
08:15 Geth ¦ Inline-Perl5: We really only care about supporting => syntax for passing named
08:15 Geth ¦ Inline-Perl5: arguments, i.e. basic Pair objects, not any hypothetical subclasses. So
08:15 Geth ¦ Inline-Perl5: we may use a cheaper check to match the exact type instead of using .isa
08:15 Geth ¦ Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/04a774ccf8
08:16 dubi0us joined #perl6
08:21 Voldenet joined #perl6
08:21 Voldenet joined #perl6
08:22 Geth ¦ Inline-Perl5: b92d7b1ce4 | (Stefan Seifert)++ | 2 files
08:22 Geth ¦ Inline-Perl5: Version 0.29
08:22 Geth ¦ Inline-Perl5: review: https://github.com/niner/Inline-Perl5/commit/b92d7b1ce4
08:26 mcmillhj joined #perl6
08:27 dubi0us joined #perl6
08:29 pierre_ joined #perl6
08:33 mr-foobar joined #perl6
08:34 mcmillhj joined #perl6
08:35 zengargoyle joined #perl6
08:44 andrzejku joined #perl6
08:44 lisbeths joined #perl6
08:45 lisbeths I've got to get similar functionality to the system function in perl
08:46 lisbeths I've tried run but it gives me this strange output rather than the terminal output
08:47 Cabanossi joined #perl6
08:47 andrzejku joined #perl6
08:48 pmurias is there stuff that's discouraging people from contributing to the Perl 6 docs?
08:48 lisbeths Probably not
08:52 dubi0us joined #perl6
08:52 moritz lisbeths: please show some example code. run() is supposed to work
08:58 dubi0us joined #perl6
08:58 lisbeths sub system($x, $y){qq:x/$x "$y"/}
08:58 lisbeths system("echo", "hello")
08:59 lisbeths Only I need it to be one string and not two
09:00 moritz then use shell(), not run()
09:00 ryu0 my $x = "echo", $y = "hello"; say "'$x' '$y'";
09:01 ryu0 m: my $x = "echo", $y = "hello"; say "'$x' '$y'";
09:01 camelia rakudo-moar 5fcce6: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Variable '$y' is not declared?at <tmp>:1?------> 3my $x = "echo", 7?5$y = "hello"; say "'$x' '$y'";?»
09:01 ryu0 m: my $x = "echo"; my $y = "hello"; say "'$x' '$y'";
09:01 camelia rakudo-moar 5fcce6: OUTPUT: «'echo' 'hello'?»
09:01 lisbeths It seems like a complicated way to do that though
09:01 lisbeths I should be able to do it with a single string
09:02 ryu0 lisbeths: you can reference variables in "" string literals to include their text form.
09:02 moritz perl6 -e 'my $str = q[echo "hello, wolrd"]; shell $str'
09:02 moritz hello, wolrd
09:02 ryu0 that's one option.
09:03 lisbeths My subroutine already works almost how I like except that I have to break a string into two pieces
09:03 lisbeths I have to get the string leading up to the first space and the string after the first space
09:12 moritz $str.split(' ', 2)
09:19 dubi0us joined #perl6
09:22 andrzejku joined #perl6
09:24 haha_ joined #perl6
09:24 lizmat joined #perl6
09:32 mr-fooba_ joined #perl6
09:32 Cabanossi joined #perl6
09:34 zengargoyle joined #perl6
09:38 pmurias Why do I get an exception 'This types (Scalar) does not support positional operations' without a backtrace?
09:38 hankache joined #perl6
09:46 pmurias it's optimizer complaining of Scalars getting mixed up into QAST because of NQP crappiness
09:48 rindolf joined #perl6
09:49 lizmat pmurias: generally that indicates a missing decont
09:50 lizmat m: use nqp; my $l = nqp::list(42); dd nqp::atpos($l,0)
09:50 camelia rakudo-moar 5fcce6: OUTPUT: «This type (Scalar) does not support positional operations?  in block <unit> at <tmp> line 1??»
09:50 lizmat m: use nqp; my $l := nqp::list(42); dd nqp::atpos($l,0)   # either bind
09:50 camelia rakudo-moar 5fcce6: OUTPUT: «42?»
09:50 lizmat m: use nqp; my $l = nqp::list(42); dd nqp::atpos(nqp::decont($l),0)   # or decont
09:50 camelia rakudo-moar 5fcce6: OUTPUT: «42?»
09:54 ryu0 ... what is this dd i keep seeing pop up?
09:54 ryu0 m: dd 1
09:54 camelia rakudo-moar 5fcce6: OUTPUT: «1?»
09:54 ryu0 m: dd
09:54 camelia rakudo-moar 5fcce6: OUTPUT: «block <unit>()?»
09:54 ryu0 m: say
09:54 camelia rakudo-moar 5fcce6: OUTPUT: «5===SORRY!5===?Argument to "say" seems to be malformed?at <tmp>:1?------> 3say7?5<EOL>?Other potential difficulties:?    Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an exp…»
09:54 ryu0 weird.
09:56 lizmat ryu0: dd is Rakudo Parl 6's built-in tiny data dumper
09:56 lizmat so tiny it lost the t
09:56 ryu0 Oh. So it's an implementation detail.
09:57 lizmat basically it does a "note $foo.perl"
09:57 lizmat m: note 1.perl
09:57 camelia rakudo-moar 5fcce6: OUTPUT: «1?»
10:01 dubi0us joined #perl6
10:02 Cabanossi joined #perl6
10:05 ijneb joined #perl6
10:06 sena_kun joined #perl6
10:12 dubi0us joined #perl6
10:27 dubi0us joined #perl6
10:31 HoloIRCUser1 joined #perl6
10:32 lisbeths` joined #perl6
10:35 pierre_ joined #perl6
10:36 dubi0us joined #perl6
10:36 yati joined #perl6
10:37 yati Hi people. How can I force rakudo to give the full stacktrace when something goes wrong? Somewhat like Carp::confess from perl 5?
10:39 yati And on a related note, is there an equivalent of local *__ANON__ = "foo" so I can name my lambdas?
10:45 dubi0us joined #perl6
10:48 renormalist in a given/when, is there some statement that gets called once iff some of the "when" matched? like a conditional fallthrough?
10:49 renormalist conditional default,I mean
10:50 ryu0 yati: --lt-exception when running perl6 might be your answer.
10:50 ryu0 yati: --ll-exception *
10:51 pmurias renormalist: you mean a statement that gets called if nothing matches?
10:51 pmurias renormalist: I mean if something matches
10:51 renormalist yes, if something
10:52 renormalist I try to find a pastie to show my silly given/when
10:53 pmurias renormalist: you can achieve that with a default+flag variable+if statement
10:54 renormalist https://gist.github.com/renormalist/f26df587188460bc5b7f4c4d9f82367a
10:55 dubi0us joined #perl6
10:55 renormalist ah, I could reverse my bool $f and reset it in default{}
10:56 renormalist pmurias: ^ see my own comment in above gist, is that what you mean?
10:57 pmurias renormalist: yes
10:59 setty1 joined #perl6
11:04 dubi0us joined #perl6
11:05 setty1 joined #perl6
11:05 pierre_ joined #perl6
11:06 Aaronepower joined #perl6
11:10 BenGoldberg joined #perl6
11:11 tyil lizmat: h-hi
11:11 lizmat tyil o/
11:12 tyil I got disconnected from the irc last night it seems
11:12 tyil was there still a hackathon?
11:12 tyil me and sam could still come
11:15 dubi0us joined #perl6
11:27 moritz PSA: I'll be updating irc.p6c.org to Debian Stretch soon
11:28 moritz that will require a reboot
11:29 stmuk ha! cperl is claimed to be getting macros
11:36 HoloIRCUser2 joined #perl6
11:39 pierre_ joined #perl6
11:41 El_Che stmuk: and grammars
11:45 HoloIRCUser4 joined #perl6
11:47 Cabanossi joined #perl6
11:48 dubi0us joined #perl6
11:55 moritz really?
11:55 ryu0 wouldn't surprise me. some P6 features are getting backports to P5 in some way.
11:56 evanm joined #perl6
11:56 coetry joined #perl6
11:57 moritz I guess the p5 regex engine has most of the infrastructure already
11:57 moritz it supports named regexes and named captures, though with a somewhat obscure syntax
11:58 moritz the thing it doesn't support yet is nested match objects
11:58 dubi0us joined #perl6
11:59 evanm Does anyone know what this error means? "No such method 'cache' for invocant of type 'NQPMu'"
12:02 evanm It's happens during a call to "await", but I have no idea what it's talking about
12:04 moritz sounds a like a pretty low-level, internal error
12:04 moritz are the things you pass to await promises?
12:05 evanm moritz: yes, they're promises
12:06 evanm For context, it happens here: https://github.com/scmorrison/uzu/blob/master/lib/Uzu/Render.pm6#L401
12:07 evanm The full error stack is in the last comment here: https://github.com/scmorrison/uzu/issues/10
12:08 dubi0us joined #perl6
12:08 gdonald joined #perl6
12:11 moritz that looks fine
12:11 moritz (I'd write that as   my @language_queue = $config<language>.map: { start { ... } };  but that's just stylistic choice; won't change the error
12:11 moritz )
12:12 lizmat tyil: sorry, missed it:
12:13 lizmat seems damnlie is going to TechInc, but have no ETA for that
12:13 andreoss joined #perl6
12:14 andreoss is there a way for roles/classes to use its child types in a base class definition?
12:15 moritz if you predeclare the child class, yes
12:16 damnlie We are at techinc
12:16 andreoss moritz: with proto?
12:16 moritz but that requires both to be in the same compunit (aka file)
12:16 moritz m: class Child { ... }; class Parent { has Child $.x }; class Child is Parent { }
12:16 camelia rakudo-moar 93a5ef: ( no output )
12:16 moritz andreoss: ^^ like this
12:17 dubi0us joined #perl6
12:18 evanm moritz: Should I file a bug against Rakudo?
12:19 moritz evanm: yes. And as a workaround, you could try to use hyper with a limited number of jobs: https://docs.perl6.org/routine/hyper
12:20 moritz uzu looks interesting
12:21 moritz do you happen to know if it supports writing pages in markdown, and rendering them as part of the build?
12:22 evanm moritz: I've asked about this, MD support is planned but not implemented
12:23 evanm It's a nice project, scmorrison is very active & responsive with feature requests
12:24 feng joined #perl6
12:25 mr-foobar joined #perl6
12:25 moritz I have plans for a new personal website for myself; this looks like a good candidate
12:27 evanm I've been moving my personal website over to it... so far it looks like a good decision
12:28 moritz I guess I should start with a concept about what should be on that site :-)
12:28 dubi0us joined #perl6
12:29 moritz [Coke], masak, pmichaud_: I need to reboot irc.p6c.org because of a OS level upgrade. When would a convenient time be?
12:30 moritz if nobody objects, I'll do it tonight around 20:00H CEST (1800H UTC, if my memory of time zones is correct)
12:32 Cabanossi joined #perl6
12:33 andreoss p: role Foo {...}; role Bar does Foo {...} ; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar { method abs {1}}; say Foo.bar.abs;
12:33 andreoss m: role Foo {...}; role Bar does Foo {...} ; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar { method abs {1}}; say Foo.bar.abs;
12:33 camelia rakudo-moar 93a5ef: OUTPUT: «Method 'abs' must be implemented by Foo because it is required by roles: Foo.?  in block <unit> at <tmp> line 1??»
12:36 andreoss why it must be implemented by Foo?
12:37 andreoss it seems it doesn't see Bar.abs at this point
12:37 ryu0 andreoss: because the parent role has no implementation for that method.
12:37 ryu0 Or so it looked.
12:37 andreoss it's supposed to be abstract
12:38 ryu0 what's so hard to understand? the method must have an implementation because you're saying it implements the methods of Foo.
12:39 ryu0 if there is no implementation, then it doesn't really implement it fully.
12:39 dubi0us joined #perl6
12:39 andreoss m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs {1}}; say Foo.bar.abs;
12:39 camelia rakudo-moar 93a5ef: OUTPUT: «Method 'abs' must be implemented by Foo because it is required by roles: Foo.?  in block <unit> at <tmp> line 1??»
12:41 hankache_ joined #perl6
12:41 andreoss Bar has concrete abs method. I call.abs on Bar object, but somehow it complains about Foo which is abstract (methods are stubbed)
12:42 andreoss m: role Bar {...}; role Foo { method abs {die} ; method bar { Bar.new } }; role Bar does Foo { method abs {1}}; say Foo.bar.abs;
12:42 camelia rakudo-moar 93a5ef: OUTPUT: «1?»
12:42 andreoss but this works
12:42 andreoss though Foo.abs is never called
12:43 ryu0 m: role Bar {...}; role Foo { method abs {...} };
12:43 camelia rakudo-moar 93a5ef: ( no output )
12:43 ryu0 m: role Bar {...}; role Foo { method abs {...} }; role Bar does Foo { method abs {1} };
12:43 camelia rakudo-moar 93a5ef: ( no output )
12:43 ryu0 m: role Bar {...}; role Foo { method abs {...} }; role Bar does Foo { method abs {1} }; say Bar.abs;
12:43 camelia rakudo-moar 93a5ef: OUTPUT: «1?»
12:44 ryu0 m: role Bar {...}; role Foo { method abs {...} method bar { Bar.new } }; role Bar does Foo { method abs {1} };
12:44 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Strange text after block (missing semicolon or comma?)?at <tmp>:1?------> 3e Bar {...}; role Foo { method abs {...}7?5 method bar { Bar.new } }; role Bar does?    expecting any of:?        in…»
12:44 ryu0 m: role Bar {...}; role Foo { method abs {...}; method bar { Bar.new } }; role Bar does Foo { method abs {1} };
12:44 camelia rakudo-moar 93a5ef: ( no output )
12:44 ryu0 m: role Bar {...}; role Foo { method abs {...}; method bar { Bar.new } }; role Bar does Foo { method abs {1} }; say Foo.bar;
12:44 camelia rakudo-moar 93a5ef: OUTPUT: «Method 'abs' must be implemented by Foo because it is required by roles: Foo.?  in block <unit> at <tmp> line 1??»
12:45 ryu0 My guess? Cyclical reference.
12:45 ryu0 Notice it only appears when the parent role references the child role.
12:45 andreoss aslo it works with classes
12:45 ryu0 Huh.
12:46 ryu0 Wait for someone more knowledgeable I guess.
12:46 andreoss m: class Bar {...}; class Foo { method abs {...} ; method bar { Bar.new } }; class Bar is Foo { method abs {1}}; say Foo.bar.abs
12:46 camelia rakudo-moar 93a5ef: OUTPUT: «1?»
12:49 moritz when you say "Foo.bar" (in the roles example), rakudo tries to pun the role Foo into a class Foo that implements that role
12:49 moritz and that point, it fails, because it contains a method stub
12:51 moritz basically, a role that contains a stub method is explicitly incomplete (like an interface in Java)
12:51 moritz ryu0: ^^
12:54 andreoss any way to use the actual method defined later other than not using a stub?
12:55 moritz andreoss: if it's implemented in Bar, call Bar.abs
12:55 moritz andreoss: or compose Bar into a class, and use the class
12:55 andreoss i use roles because i need parametic property
12:55 dubi0us joined #perl6
12:56 moritz m: class Foo { method abs { ... } }; class Bar is Foo { method abs { 1 } }; Foo.abs
12:56 camelia rakudo-moar 93a5ef: OUTPUT: «Stub code executed?  in method abs at <tmp> line 1?  in block <unit> at <tmp> line 1??»
12:56 moritz same error with classes: you have to reference the implementation, not the stub, to use it
13:00 HoloIRCUser6 joined #perl6
13:01 HTTP_____GK1wmSU joined #perl6
13:03 pmurias wow, modules.perl6.org looks good now
13:03 pmurias tremendous upgrade from looking like shit :)
13:04 HTTP_____GK1wmSU left #perl6
13:04 moritz PSA: Apress will publish https://leanpub.com/perl6regex/ so I have to pull it off leanpub Very Soon[tm]
13:04 andreoss m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs { 1 }}; my Bar $b = Foo.bar; say $b.^methods;
13:04 camelia rakudo-moar 93a5ef: OUTPUT: «Method 'abs' must be implemented by Foo because it is required by roles: Foo.?  in block <unit> at <tmp> line 1??»
13:05 andreoss Bar.new is being constructed from `role Bar {...}` not from the latter definition, is it correct?
13:06 moritz yes
13:07 moritz but calling a method on Foo tries to pun the role
13:07 moritz Foo.bar is something like (anon class Foo does Foo { }).bar
13:07 moritz and that it what doesn't work
13:08 andreoss can i reffer to the latter concrete definition somehow?
13:08 moritz what do you mean by "latter concrete defintion" here?
13:08 andreoss the second one `role Bar does Foo ...`
13:09 andreoss without a stub
13:09 moritz m: m: role Bar {...}; role Foo { method abs {...} ; method bar { Bar.new } }; role Bar does Foo { method abs { 1 }}; my Bar $b = Bar.bar; say $b.^methods
13:09 camelia rakudo-moar 93a5ef: OUTPUT: «(bar abs)?»
13:09 moritz andreoss: ^^ sure
13:09 moritz just use Bar, not Foo
13:09 moritz and you're good
13:09 El_Che moritz: you're becoming quite the author
13:09 El_Che nice
13:09 moritz El_Che: :-)
13:09 andreoss the point was to create a Bar object from the Foo role
13:10 andreoss i.e use Foo as a factory
13:10 moritz and if that works well, I'll rework my book on Continuous Delivery book into CI/CD for python, and have it published too
13:10 moritz andreoss: you can't use Foo as a factory; it's abstract
13:10 moritz just like you can't use a Java Interface as a factory
13:11 andreoss but I still can call ::?CLASS:U methods on it
13:11 * ryu0 tries to make a concrete factory but gets abstract errors.
13:11 moritz andreoss: on subclasses that implement all stub methods, not on Foo itself
13:11 moritz (or roles, not just classes)
13:12 moritz if you need a factory, have a separate role or class for it
13:12 araraloren it's like Foo is one component of that role/class
13:13 andreoss okay, it seems i get it now
13:13 lucs joined #perl6
13:14 araraloren have you read perl6 introduction http://perl6intro.com/ ?
13:14 araraloren andreoss, it's a good tutorial :)
13:15 andreoss probably some long time ago
13:15 * moritz would recommend his book, but it doesn't go deep into roles
13:16 andreoss there's not so much materials available on parametric roles and stuff that can be done with them
13:18 andreoss so many
13:27 El_Che moritz: in my mind the languages that are creating some buzz (next to the nth JS framework) are Go and Rust. Python, not so much
13:29 evanm moritz: just fyi I've filed a couple of bugs with "await". One's a segfault :-/ https://rt.perl.org/Ticket/Display.html?id=131888 https://rt.perl.org/Ticket/Display.html?id=131889
13:31 jnthn Do they go away if use v6.d.PREVIEW is removed?
13:31 El_Che moritz: I hope you get feedback from the people that brought your book at TPCiA
13:32 evanm jnthn: I still see the segfault in #131889 after removing v6.d.PREVIEW
13:32 synopsebot6 Link:  https://rt.perl.org/rt3/Public/Bug/Display.html?id=131889
13:32 dubi0us joined #perl6
13:32 jnthn Hm, OK
13:33 El_Che hi jnthn
13:34 El_Che fyi #perl6: I was under the impression that there was a possitive vibe regarding perl6 at tpcia
13:34 jnthn o/ El_Che
13:34 El_Che (of course subjective as hell, but that was my impression)
13:35 El_Che Damian's talk helped of course
13:36 El_Che (but personnaly, it was jnthn's talk at fosdem some years ago that got me exited about the lang)
13:41 AlexDaniel evanm: would be great if the code was golfed down a little bit so that it's easier to see where the issue is. It's not that hard to achieve a segfault (e.g. RT #128870), but it's not always rakudo/moarvm's fault
13:41 synopsebot6 Link:  https://rt.perl.org/rt3/Public/Bug/Display.html?id=128870
13:43 AlexDaniel evanm: I'm saying this because I had tens of cases when I was cursing on rakudo/moarvm but then realized that I was doing something very dumb :)
13:45 HoloIRCUser1 joined #perl6
13:48 dubi0us joined #perl6
13:50 evanm AlexDaniel: sure, it could be a bug in the application code, but unless there's NativeCall involved I'd think a segfault indicates a VM bug
13:51 evanm as jnthn states in the issue you linked, "SEGV isn't an OK failure mode."
13:52 hankache_ joined #perl6
14:02 Cabanossi joined #perl6
14:08 HoloIRCUser4 joined #perl6
14:10 HoloIRCUser7 joined #perl6
14:25 dubi0us joined #perl6
14:33 andreoss m: (Array[Int]).WHAT.say;
14:33 camelia rakudo-moar 93a5ef: OUTPUT: «(Array[Int])?»
14:33 andreoss how can i get Int from it?
14:38 timotimo m: say Array[Int].of.perl
14:38 camelia rakudo-moar 93a5ef: OUTPUT: «Int?»
14:42 HoloIRCUser1 joined #perl6
14:47 Cabanossi joined #perl6
14:50 HoloIRCUser joined #perl6
14:50 haha_ joined #perl6
14:58 HoloIRCUser1 joined #perl6
15:01 evanm joined #perl6
15:07 cdg joined #perl6
15:13 andreoss timotimo: what about general case?
15:14 khw joined #perl6
15:15 timotimo hmm good question
15:16 timotimo might have to rely on the role itself to expose its parameters to users
15:18 mr-fooba_ joined #perl6
15:19 andreoss m: role Foo[::A]; Foo[*].WHAT.say;
15:19 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Semicolon form of 'role' without 'unit' is illegal.  You probably want to use 'unit role'?at <tmp>:1?------> 3role Foo[::A];7?5 Foo[*].WHAT.say;?»
15:19 andreoss m: role Foo[::A]{}; Foo[*].WHAT.say;
15:19 camelia rakudo-moar 93a5ef: OUTPUT: «(Foo[Whatever])?»
15:19 andreoss m: role Foo[::A]{}; Foo[*].^lookup('new').say;
15:19 camelia rakudo-moar 93a5ef: OUTPUT: «No such method 'lookup' for invocant of type 'Perl6::Metamodel::CurriedRoleHOW'?  in block <unit> at <tmp> line 1??»
15:19 timotimo oh
15:20 timotimo m: .perl.say for Array[Int].^role_arguments()
15:20 camelia rakudo-moar 93a5ef: OUTPUT: «No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ClassHOW+{<anon>}+{<anon>}'?  in block <unit> at <tmp> line 1??»
15:20 timotimo oh, that's only the CurriedRoleHow
15:20 timotimo so
15:20 timotimo m: for Array[Int].^roles -> $r { for $r.^role_arguments -> $a { $a.perl.say  } }
15:20 camelia rakudo-moar 93a5ef: OUTPUT: «Int?No such method 'perl' for invocant of type 'TValue'?  in block  at <tmp> line 1?  in block <unit> at <tmp> line 1??»
15:21 timotimo m: for Array[Int].^roles -> $r { for $r.^role_arguments -> $a { try $a.perl.say  } }
15:21 camelia rakudo-moar 93a5ef: OUTPUT: «Int?No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ParametricRoleGroupHOW'?  in block <unit> at <tmp> line 1??»
15:21 timotimo well, would have to grep for the CurriedRoleHOW
15:22 andreoss m: role F[::A] {}; F[Int].^role_arguments[0].say;
15:22 camelia rakudo-moar 93a5ef: OUTPUT: «(Int)?»
15:22 andreoss m: Array[Int].^role_arguments[0].say;
15:22 camelia rakudo-moar 93a5ef: OUTPUT: «No such method 'role_arguments' for invocant of type 'Perl6::Metamodel::ClassHOW+{<anon>}+{<anon>}'?  in block <unit> at <tmp> line 1??»
15:25 andreoss how is Array a class and parametric?
15:26 timotimo every role can be used as a class
15:26 timotimo m: role See[$this] { }; See[1].new.perl.say
15:26 camelia rakudo-moar 93a5ef: OUTPUT: «See[Int].new?»
15:26 timotimo m: role See[$this] { }; See[1].HOW.^name.say
15:26 camelia rakudo-moar 93a5ef: OUTPUT: «Perl6::Metamodel::CurriedRoleHOW?»
15:27 andreoss but Array is not a role
15:27 timotimo m: role See[$this] { }; See[1].new.HOW.^name.say
15:27 camelia rakudo-moar 93a5ef: OUTPUT: «Perl6::Metamodel::ClassHOW?»
15:27 timotimo let me have a look
15:28 timotimo the important bits are in TypedArray.pm
15:28 timotimo it's a class with a .^parameterize method
15:31 wamba joined #perl6
15:32 Cabanossi joined #perl6
15:35 andreoss the brackets don't match for some reason
15:36 timotimo yeah
15:36 timotimo these pm files are really just concatenated into one gigantic file
15:36 pierre_ joined #perl6
15:48 evanm joined #perl6
16:02 Cabanossi joined #perl6
16:04 HoloIRCUser joined #perl6
16:04 HoloIRCUser6 joined #perl6
16:05 nadim joined #perl6
16:12 andreoss m: package A { our proto f($) {*} }; package A { our multi f(1) { "one" }};
16:12 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Cannot use 'our' with individual multi candidates. Please declare an our-scoped proto instead?at <tmp>:1?------> 3 }; package A { our multi f(1) { "one" }7?5};?    expecting any of:?        h…»
16:14 timotimo i didn't know you could re-open a package just like that
16:14 andreoss are packages file-scoped?
16:15 dubi0us joined #perl6
16:15 andreoss m: package A { sub f($) { 1 } }; package A { sub g { f(0) }}; say A::g();
16:15 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Undeclared routine:?    f used at line 1??»
16:15 andreoss seems not
16:16 timotimo "file-scoped"?
16:16 andreoss i thought one could re-open package if it's kept in a sigle file
16:17 timotimo it'd be nice if it properly warned if this isn't explicitly a feature
16:19 mst andreoss: subroutines are lexical, so obviously f() won't be in scope for g()
16:19 timotimo oh, right, you dropped the "our" there
16:19 pilne joined #perl6
16:20 andreoss m: package A { our sub f($) { 1 } }; package A { our sub g { f(0) }}; say A::g();
16:20 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Undeclared routine:?    f used at line 1??»
16:22 itaylor57 joined #perl6
16:25 itaylor57 joined #perl6
16:30 dubi0us joined #perl6
16:30 zengargoyle joined #perl6
16:35 andreoss m: package F {}; say F.^archetypes;
16:35 camelia rakudo-moar 93a5ef: OUTPUT: «Too many positionals passed; expected 1 argument but got 2?  in block <unit> at <tmp> line 1??»
16:36 timotimo m: package F {}; say F.HOW.archetypes
16:36 camelia rakudo-moar 93a5ef: OUTPUT: «No such method 'gist' for invocant of type 'Perl6::Metamodel::Archetypes'. Did you mean 'isa'??  in block <unit> at <tmp> line 1??»
16:36 timotimo heh.
16:37 timotimo archetypes doesn't take the $object argument that the .^ notation helpfully gives you for free
16:37 andreoss i believe it should be `method archetypes($obj) ...`
16:37 Aaronepower joined #perl6
16:37 timotimo well, all of rakudo uses it like Thing.archetypes.something
16:38 timotimo or rather Thing.HOW.archetypes.something
16:38 timotimo i'll be AFK for a bit
16:39 araraloren why `package A { sub f($) { 1 } }; package A { sub g { A::f(0) }};` not produce redeclaration error ?
16:40 andreoss because of local scope?
16:40 andreoss m: my package A { our sub f($) { 1 } }; my package A { our sub g { f(0) }}; say A::g();
16:40 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Undeclared routine:?    f used at line 1??»
16:40 dubi0us joined #perl6
16:41 araraloren I just know they don't like namespace in c++, in c++ we can separate namespace into multi file
16:42 araraloren m: package A { our sub f($) { 1 } }; package A { our sub g { A::f(0) }};  say A::g();
16:42 camelia rakudo-moar 93a5ef: OUTPUT: «1?»
16:42 pharv_ joined #perl6
16:42 * araraloren AFK a little too
16:45 andreoss araraloren: this doesn't work across files though
16:45 BenGoldberg joined #perl6
16:47 Cabanossi joined #perl6
16:54 dubi0us joined #perl6
16:58 araraloren andreoss, yeah, that's what I mean above
17:07 dubi0us joined #perl6
17:09 smls joined #perl6
17:10 smls m:  role R { method x { "Role wins!" } };  class A does R { has $.x = "Attr wins!" };  say A.new.x;
17:10 camelia rakudo-moar 93a5ef: OUTPUT: «Role wins!?»
17:11 smls ^^ Is a method from a role supposed to override an auto-generated attribute accessor of the class, rather than the other way around?
17:11 dubi0us joined #perl6
17:12 HoloIRCUser2 joined #perl6
17:13 moritz yes
17:13 moritz the role composition comes first
17:13 moritz and the attribute only generates an accessor if the class doesn't have a method of that name
17:14 smls In that case, could the  `has $.x`  maybe throw a warning here, suggesting to write  `has $!x`  because that's what it ends up doing anyway?
17:14 moritz m:  role R { method x { "Role wins!" } };  class A { has $.x = "attr wins"; does R }; A.new.x
17:14 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Undeclared routine:?    does used at line 1??»
17:14 moritz m:  role R { method x { "Role wins!" } };  class A { has $.x = "attr wins"; also does R }; A.new.x
17:14 camelia rakudo-moar 93a5ef: ( no output )
17:14 moritz m:  role R { method x { "Role wins!" } };  class A { has $.x = "attr wins"; also does R }; say  A.new.x
17:14 camelia rakudo-moar 93a5ef: OUTPUT: «Role wins!?»
17:15 moritz seems to happen at compile time anyway
17:15 andreoss can i export routines imported from another module?
17:16 andreoss or anything like perl5's Import::Into?
17:16 moritz I think re-exporting is not yet implemented
17:18 smls moritz: "the attribute only generates an accessor if the class doesn't have a method of that name" -- Do you know why that is?
17:20 smls Is there a reason to write `$.foo` instead of `$!foo` if one doesnt't want the accessor generated?
17:21 MasterDuke_ joined #perl6
17:24 xinming joined #perl6
17:26 MasterDuke joined #perl6
17:27 smls I changed my class code to  `has $!foo; method foo { $!foo }`  now...  I just worry that my future self (or another person modifying the code down the line) will look at it and think "Hey, this could be written more simply with an auto-accessor!" and break it again, and the compiler won't complain.
17:33 araraloren smls, as jnthn++ said, the accessor only generate when missing
17:36 araraloren and I think one common reason is you can use named argument in default constructor
17:36 dubi0us joined #perl6
17:37 Guest69863 joined #perl6
17:38 araraloren $!foo mean private attribute, and you need provide BUILD if you want set foo with named argument
17:41 smls araraloren: Ah, you mean people intentionally use a `$.` attribute and a method with the same name, so that they can initialize the attribute with the default constructor but still manually control what the accessor returns?
17:43 smls Never thought of that.
17:44 rindolf joined #perl6
17:46 dubi0us joined #perl6
17:47 Cabanossi joined #perl6
17:50 MasterDuke joined #perl6
17:52 smls Wondering if it was always like that...
17:52 smls bisectable6:  class A { has $.x = 1; method x { 2 } };  say A.x;
17:52 bisectable6 smls, On both starting points (old=2015.12 new=93a5eff) the exit code is 0 and the output is identical as well
17:52 bisectable6 smls, Output on both points: «2»
17:53 smls ok :)
17:53 tadzik joined #perl6
17:55 dubi0us joined #perl6
17:59 smls PS: Another possible reason for concern (other than the work-around practically inviting people to re-break it), is that it can cause 'action at a distance'. In fact that's how I hit the issue:
17:59 tyil[m] joined #perl6
17:59 wictory[m] joined #perl6
17:59 unclechu joined #perl6
17:59 M-Illandan joined #perl6
17:59 mack[m] joined #perl6
17:59 ilmari[m] joined #perl6
17:59 Matthew[m] joined #perl6
17:59 d4l3k_ joined #perl6
18:00 xui_nya[m] joined #perl6
18:00 mienaikage joined #perl6
18:00 CIAvash[m] joined #perl6
18:00 smls I had working code where a role privided a stub method  `method x {...}`, and classes implemented it. Then I changed to stub to a default implementation, and didn't expect that to affect the already working classes...
18:01 smls But it broke the class that used a `$.` attribute as its implementation of the method, and the breakage only manifested (in an annoying-to-track-down way) at run-time.
18:05 smls If the only reason for the current behavior is to make "auto-constructor but manual accessor" possible, I wonder if there's not a better way that could have been done (or can be in 6.d), e.g. a trait for `$!` attributes to add them to the auto-constructor?
18:06 camelia joined #perl6
18:06 dubi0us joined #perl6
18:08 araraloren smls, hmm, I got you, have no idea.
18:08 geekosaur smls, thing is a similar argument can be made in the other direction "hey, we told it to gnerate an accessor, why aren't we using it?" <<breakage>>
18:09 geekosaur and the dot is useful for "this has an accessor/is public" documentation, regardless of where said accessor came from
18:10 timotimo the part about the constructor is the most important here
18:10 smls geekosaur: I don't understand the «why aren't we using it?" <<breakage>>» part.
18:11 smls If `$.foo` always tried to generate the accessor, no matter what, than the worst-case scenario would be a compiler error/warning if the method already exists, no?
18:14 araraloren smls, I agree with u. I hate the default behavior sometimes. Some terrible thing happen just because we miss something in document, I wonder are we using C ?
18:15 andreoss m: use MONKEY-TYPING; class Foo { our proto sub f($) {*} }; augment class Foo { multi sub f(1) { "one" } }; say Foo::f(10);
18:15 camelia rakudo-moar 93a5ef: OUTPUT: «Cannot resolve caller f(Int); Routine does not have any candidates. Is only the proto defined??  in block <unit> at <tmp> line 1??»
18:15 andreoss m: use MONKEY-TYPING; class Foo { our proto sub f($) {*} }; augment class Foo { our multi sub f(1) { "one" } }; Foo::f(10);
18:15 camelia rakudo-moar 93a5ef: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>?Cannot use 'our' with individual multi candidates. Please declare an our-scoped proto instead?at <tmp>:1?------> 3class Foo { our multi sub f(1) { "one" }7?5 }; Foo::f(10);?    expecting any of…»
18:17 andreoss m: use MONKEY-TYPING; class Foo { proto method f($) {*}; multi method f(0) {"zero"}}; augment class Foo { multi method f(1) { "one" } }; say Foo.f(1);
18:17 camelia rakudo-moar 93a5ef: OUTPUT: «one?»
18:17 andreoss proto is shared for methods, but not for subs
18:33 geekosaur short form of what you already said?
18:38 haha_ joined #perl6
18:44 raschipi joined #perl6
19:08 yqt joined #perl6
19:10 ckraniak Is there a way to make an explicitly sized array in Native Call?
19:10 D33P-B00K joined #perl6
19:10 andreoss geekosaur: just wondering why
19:11 ckraniak Specifically, it will go in a struct and the struct has to be a certain size
19:11 timotimo ckraniak: sorry, we don't have support for that yet :(
19:12 D33P-B00K left #perl6
19:14 ckraniak Ok, time to try a workaround
19:14 ckraniak (famous last words)
19:16 timotimo https://github.com/timo/SDL2_raw-p6/blob/master/lib/SDL2/Raw.pm#L106 ;_;
19:25 ckraniak Good to know that what I was fixing to do will work :D
19:25 ckraniak Thanks
19:25 timotimo yw
19:26 ckraniak Now to automate it so I don't need to copy paste 128 of them
19:27 ckraniak I looked into EXEC but it seems I can't define a class and then use it outside
19:28 timotimo you can, you just have to pass it on somehow and install it properly
19:28 TEttinger joined #perl6
19:29 timotimo m: use MONKEY-SEE-NO-EVAL; my \class = EVAL('class Omg { has $.foo; method lol { say "hi" } }'); class.new.lol
19:29 camelia rakudo-moar 93a5ef: OUTPUT: «hi?»
19:30 ckraniak Ooo
19:31 timotimo if you want to have something like "class Other is class" you'll have to do it at begin-time either with a BEGIN or by making it "constant class = ..."
19:35 ckraniak No lexical found with name $_
19:37 timotimo where is that?
19:40 ckraniak This is if I uncomment the EVAL
19:41 timotimo i'd have to see more of the code in question
19:42 geekosaur ckraniakarray support is generally weak currently
19:42 geekosaur er
19:42 ckraniak Might just write a file and import it
19:42 ckraniak Then delete it
19:42 geekosaur ckraniak, array support is generally weak currently
19:42 mst "array support" ?
19:42 mst ohh. for Native Call
19:43 mst don't mind me, didn't read sufficient scrollback before placing foot in mouth
19:43 nadim joined #perl6
19:43 timotimo foot in mouth is basically how cats clean their paws
19:43 ugexe lowercase a means native as well
19:47 eater is there a reason why Supply doesn't have an `once` function?
19:47 ugexe what would you expect it to do?
19:48 eater return a promise which will resolve with the next item
19:48 eater or the first if it isn't a live supply
19:48 ugexe Supply.head ?
19:48 ugexe m: sub foo { once { say 100; } }; foo; foo; # once already exists
19:48 camelia rakudo-moar 93a5ef: OUTPUT: «100?»
19:49 eater ah
19:50 dubi0us joined #perl6
19:53 dubi0us_ joined #perl6
20:01 dubi0us joined #perl6
20:01 eater ah
20:01 eater there is .one
20:02 Cabanossi joined #perl6
20:04 ugexe i dont think that does what you want
20:04 eater not yet!
20:06 ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; $supply.head.tap(*.say); $supplier.emit(1); $supplier.emit(2)
20:06 camelia rakudo-moar 93a5ef: OUTPUT: «1?»
20:06 eater m: sub one($supply) { my $p = Promise.new; my $v = $p.vow; $supply.head(1).tap(-> $d { $v.keep($d); }); return $p; }; say await one(Supply.from-list(0 .. 5));
20:06 camelia rakudo-moar 93a5ef: OUTPUT: «0?»
20:08 eater idk if it's worth enough to put in Supply itself tho
20:08 ugexe you really want it to not print anything if your list is 0 .. Inf ?
20:08 eater ugexe: what do you mean?
20:11 ugexe m: say 1 ~~ Supply.from-list(^Inf).one
20:12 camelia rakudo-moar 93a5ef: OUTPUT: «(timeout)»
20:12 Sgeo joined #perl6
20:13 eater oh!
20:13 ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; my $p = $supply.head.Promise; react { whenever $p { say "got it" }; $supplier.emit(1); $supplier.emit(2); }
20:13 camelia rakudo-moar 93a5ef: OUTPUT: «got it?»
20:14 eater so this is .head waiting for the Supply to complete I guess?
20:14 eater which seems odd behaviour imo
20:15 ugexe no
20:15 ugexe .head acts just like it does on lists
20:15 yoleaux ugexe: Sorry, that command (.head) crashed.
20:16 dubi0us joined #perl6
20:16 ugexe m: my $l = (^Inf).list; say $l.head # head isn't waiting for the "list" to complete
20:16 camelia rakudo-moar 93a5ef: OUTPUT: «0?»
20:16 eater m: say await Supply.from-list(^Inf).head(1);
20:17 ugexe its not getting to .head
20:17 eater oh
20:17 camelia rakudo-moar 93a5ef: OUTPUT: «(timeout)»
20:17 eater It's awaiting every statement?
20:17 eater m: my $s = Supply.from-list(^Inf); say await $s.head(1);
20:17 camelia rakudo-moar 93a5ef: OUTPUT: «(timeout)»
20:17 eater or does the supply form head also close when it's parent closes?
20:18 eater s/form/from/
20:19 tokomer joined #perl6
20:20 ugexe its returns a Supply
20:22 ugexe you close suppliers and taps
20:23 eater when they're fullfilled, yea
20:23 ugexe i mean what do you mean by "supply form head also close"
20:25 eater well, maybe I'm wrong, but await Supply.from-list(^Inf).head(1) should work w/o timeout in what I'm currently seeing and thinking
20:25 eater from-list feeds .head, and head closes when it has 1 item
20:25 ugexe from-list is creating infinite elements
20:26 Sgeo_ joined #perl6
20:26 ugexe its not creating a lazy list that could be up to infinite
20:27 eater ah
20:27 eater yea
20:27 eater it's generating a supply which is infinite
20:29 coetry joined #perl6
20:30 pharv_ joined #perl6
20:31 ckraniak So CStruct can only take ~105 values?
20:31 dubi0us joined #perl6
20:32 ckraniak "CStruct can't perform boxed bind on flattened attributes yet"
20:32 ckraniak Goes away if I delete a few attributes
20:32 ugexe m: my $supplier = Supplier.new; my $supply = $supplier.Supply; $supply.head.tap(*.say); (^Inf).map({ $supplier.emit($_); last if ++$ });
20:32 camelia rakudo-moar 93a5ef: OUTPUT: «0?»
20:33 ugexe the last is only in there so it doesn't timeout after printing 0
20:35 timotimo ckraniak: that error supposedly happens when you try to assign a CStruct into an attribute that is defined "HAS blah $.other_thing"
20:36 user3 joined #perl6
20:37 andreoss is there a way to determine if a multi sub defined for a certain type of argument?
20:37 timotimo yeah, but i forgot which of the ones it is
20:37 jnthn andreoss: https://docs.perl6.org/routine/cando
20:37 timotimo that's the one!
20:38 cdg joined #perl6
20:39 user3 I want to define a named regex n that matches the text inside a single-quoted string without matching the single quotes. I tried this one which doesn't work:
20:39 user3 m: my regex n { \'(<-[']>+)\' }; "'a bbb'" ~~ / (<n>) /; say "$0"
20:39 camelia rakudo-moar 93a5ef: OUTPUT: «'a bbb'?»
20:40 ckraniak So far as I can tell it is only affected by the number of attributes in the definition of the class
20:40 timotimo you can use a lookbehind and lookahead assertion
20:40 jnthn m: my regex n { \'(<-[']>+)\' }; "'a bbb'" ~~ &n; say "$0"
20:40 camelia rakudo-moar 93a5ef: OUTPUT: «a bbb?»
20:40 jnthn (<n>) / wraps it in another level of match object
20:40 jnthn So you'd have to say $<n>[0] to get at the capture inside of n
20:42 user3 thx. i'll run a few tests
20:43 ugexe there is always <(
20:45 Sgeo__ joined #perl6
20:48 ckraniak More fun: error goes away if I define a second class exactly the same but with another name right after
20:49 ckraniak And comes back of I comment out the original class and try to use the new one
20:49 ckraniak *if
20:50 konsolebox joined #perl6
20:55 dubi0us joined #perl6
20:56 ugexe try just adding comments and see if it changes
20:57 ckraniak Ok this will be longwinded
20:57 ckraniak To get the CStruct class A to not complain about not being able to boxed bind
20:58 ckraniak I can define a class B just before it, but it must have at least 41 uint16 attributes
20:58 ckraniak I cannot comment out the attributes
20:59 ckraniak If this were C I would suspect an undefined / uninitialized value somewhere
20:59 Guest69863 joined #perl6
21:00 zakharyas joined #perl6
21:01 ugexe in the future all classes have exactly 41 uint16 attributes
21:02 ckraniak I am trying to write a struct for OsVersionInfoExW
21:02 Cabanossi joined #perl6
21:03 ckraniak And expanding the WCHAR[128] to 128 uint16s
21:03 ckraniak to get the memory layout correct
21:03 zengargoyle joined #perl6
21:09 timotimo did you get something interesting by --ll-exception?
21:11 dubi0us joined #perl6
21:12 ckraniak timotimo: if you are asking me, I don't know what that means
21:12 timotimo it ought to give you a more complete stack trace for your error
21:13 ckraniak ok you mean command line parameter
21:13 ckraniak --||- looks like it could be a perl operator
21:14 ckraniak Oh that is two Ls
21:14 ckraniak Woooow
21:14 timotimo yup
21:15 timotimo "low level" exception
21:15 timotimo i.e. don't cut out all lines that are in the core setting or the compiler
21:17 raschipi ckraniak: You need a better programming font.
21:20 eater oh
21:20 eater that --ll-exception helped :>
21:21 ckraniak IRC on phone
21:22 ckraniak I don't have internet at home :\
21:22 eater doh
21:22 eater temporarely?
21:22 ckraniak No forever. I would 100% waste all my time on World of Tanks if I had it
21:23 eater :(
21:23 ckraniak Much rather deal with this inconvenience than that one
21:27 ckraniak Well I know the trace goes through Mu BUILDALL but I already knew it throws on newing the class
21:28 timotimo mhm, right
21:29 ckraniak I don't see anything I could use
21:29 timotimo i don't see anything at all :P
21:30 eater timotimo: time to call a doctor then :o
21:31 timotimo hah
21:32 Cabanossi joined #perl6
21:33 ckraniak Might just go to some Wi-Fi hotspot so I can pastebin this
21:33 andreoss ckraniak: you could install OpenBSD or something else that doesn't have games instead
21:33 dubi0us joined #perl6
21:33 emeric joined #perl6
21:35 raschipi m:  my $i = (3.22)/500;my @a = 1,((* × (1 + $i)) + 1) ...?; printf "{$++}: \$%.2f\n", 500 * @a[$_] - 50 for ^19 #Nice
21:35 camelia rakudo-moar 93a5ef: OUTPUT: «0: $450.00?1: $953.22?2: $1459.68?3: $1969.40?4: $2482.41?5: $2998.72?6: $3518.35?7: $4041.33?8: $4567.68?9: $5097.42?10: $5630.57?11: $6167.15?12: $6707.19?13: $7250.70?14: $7797.72?15: $8348.26?16: $8902.34?17: $9460.0…»
21:41 setty1 joined #perl6
21:42 dubi0us joined #perl6
21:43 lizmat joined #perl6
21:44 ckraniak andreoss: I have 4.8 dual boot on the other laptop, getting rid of Windows would help but the idea was to not have internet at all
21:44 ckraniak Phone is a big in the reasoning, not an excuse
21:44 ckraniak s/big/bug
21:53 [Coke] moritz: thanks for the headsup, whenevs.
21:58 pharv_ joined #perl6
21:58 [Coke] (I'm here now, so for me, now is awesome. :)
21:59 Hotkeys joined #perl6
22:06 andreoss making type classes by augmenting doesn't seem to be a good way now
22:07 zengargoyle joined #perl6
22:08 zengargoyle joined #perl6
22:11 dubi0us joined #perl6
22:21 dubi0us joined #perl6
22:23 zengargoyle joined #perl6
22:30 dubi0us joined #perl6
22:31 * AlexDaniel ? Sets
22:32 timotimo sets rock
22:32 timotimo bags rocker
22:32 timotimo mixes rockest
22:34 AlexDaniel mixhash rockhashest?
22:35 timotimo mixhash rocks variably
22:35 AlexDaniel hmm should I use ? or (-)
22:36 zengargoyle joined #perl6
22:36 timotimo honestly i prefer (-) because my font also suck
22:36 timotimo sucks
22:37 ckraniak https://pastebin.com/9KUUZM9R
22:47 ilbot3 joined #perl6
22:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
22:52 andreoss raschipi: you might take a look at --backend=ast
22:53 raschipi I'm aware of that, thanks.
22:55 dubi0us joined #perl6
22:55 timotimo you can get the compiler and give it a :target argument
22:56 geekosaur rockest science? :p
22:57 raschipi timotimo: from inside Perl6?
22:57 timotimo yeah
22:57 timotimo m: use nqp; nqp::getcomp('Perl6').perl.say
22:57 camelia rakudo-moar 4f1322: OUTPUT: «Cannot call method 'perl' on a null object?  in block <unit> at <tmp> line 1??»
22:57 timotimo m: use nqp; nqp::getcomp('perl6').perl.say
22:57 camelia rakudo-moar 4f1322: OUTPUT: «No such method 'perl' for invocant of type 'Perl6::Compiler'?  in block <unit> at <tmp> line 1??»
22:58 timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).dump.say
22:58 camelia rakudo-moar 4f1322: OUTPUT: «- QAST::CompUnit  :W<?> :UNIT<?>?  [pre_deserialize]?    - QAST::Stmt ?      - QAST::Stmt ?        - QAST::Op(loadbytecode) ?          - QAST::VM ?            [jvm]?              - QAST::SVal(ModuleLoader.class) ?            [moar]?    …»
22:58 timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).WHAT.say
22:58 camelia rakudo-moar 4f1322: OUTPUT: «No such method 'say' for invocant of type 'QAST::CompUnit'?  in block <unit> at <tmp> line 1??»
22:58 timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).^name.say
22:58 camelia rakudo-moar 4f1322: OUTPUT: «QAST::CompUnit?»
22:58 timotimo m: use nqp; nqp::getcomp('perl6').eval("say 'whoa'", :target<ast>).^methods.map(*.name).say
22:58 camelia rakudo-moar 4f1322: OUTPUT: «(new sc hll load main compilation_mode pre_deserialize post_deserialize repo_conflict_resolver code_ref_blocks is_nested extra_children dump_children list unshift dump_node_list shift shallow_clone set_children pop push new set list node returns named fl…»
22:58 timotimo how do you like this? :)
22:59 timotimo m: use nqp; nqp::getcomp('perl6').stages.perl.say
22:59 camelia rakudo-moar 4f1322: OUTPUT: «("start", "parse", "syntaxcheck", "ast", "optimize", "mast", "mbc", "moar")?»
22:59 timotimo ^- you can feed a qast (that you might have changed) directly to the optimize or mast stage
23:01 timotimo stages in the compiler are just methods with the same name
23:01 timotimo find more compiler stuff in nqp's repo under HLL/Compiler.nqp and rakudo's Perl6/Compiler.nqp
23:02 AlexDaniel eval :target<ast> :O
23:02 dubi0us_ joined #perl6
23:03 zengargoyle joined #perl6
23:03 timotimo should also be able to pass :target to EVAL
23:04 user3 left #perl6
23:05 raschipi Nice. What's Perl6::Parse for, then?
23:06 timotimo it makes things better i guess?
23:11 lizmat joined #perl6
23:11 dubi0us joined #perl6
23:12 sivoais joined #perl6
23:12 ugexe you can do all of that with Perl6::Parse if you know what you're doing
23:12 timotimo QAST is classes from nqp land and thus they aren't very perl6-friendly
23:12 timotimo like no .perl method
23:15 raschipi Any motive to keep nqp around instead of going for self-hosted?
23:15 timotimo performance is one
23:15 timotimo the more limited semantics nqp has allow for more aggressive optimization
23:16 timotimo for example, there's no scalar containers at all
23:20 raschipi Why not just introduce those types in Perl6 directly?
23:20 timotimo "those types"?
23:20 ugexe m: use Perl6::Grammar:from<NQP>; use Perl6::Actions:from<NQP>; my $*LINEPOSCACHE; my $source-code = q/use Test; my $x; $x++; say $x;/; my NQPMatch $tree = Perl6::Grammar.parse($source-code, :actions(Perl6::Actions.new())); say $tree.dump;
23:20 camelia rakudo-moar 4f1322: OUTPUT: «- statementlist: use Test; my $x; $x++; say $x;?  - statement: 4 matches?    - statement_control: use Test?      - doc: ?      - sym: use?      - module_name: Test?        - longname: Test?          - name: Test?            - identifier: …»
23:21 dubi0us joined #perl6
23:21 jnthn The self-hosting nature of NQP certainly rears its head and makes development more costly now and then. It's manageable because relatively few of the changes happen there.
23:22 jnthn I'm glad all those working in Rakudo, myself included, don't have to deal with self-hosting there.
23:23 jnthn And anyone who thinks eliminating NQP would make bootstrapping issues vanish is waaaay to optimistic. We'd still have them, just somewhere else, and I suspect harder to debug.
23:24 jnthn That's presuming than a project to eliminate NQP even was successful in the first place.
23:24 jnthn Which, uh...well, that's a project I'd absolutely not wish to have on my plate.
23:26 jnthn *that a project
23:27 jnthn Spending the effort on getting macros and the QTree ideas from 007 into Rakudo would seem a far better use of effort.
23:30 timotimo looking forward to having that :)
23:32 Cabanossi joined #perl6
23:33 dubi0us joined #perl6
23:41 dubi0us joined #perl6
23:50 tadzik joined #perl6
23:50 dubi0us joined #perl6
23:56 tyil[m] joined #perl6
23:56 unclechu joined #perl6
23:56 mack[m] joined #perl6
23:56 wictory[m] joined #perl6
23:56 M-Illandan joined #perl6
23:56 Matthew[m] joined #perl6
23:56 xui_nya[m] joined #perl6
23:56 ilmari[m] joined #perl6
23:56 mienaikage joined #perl6
23:56 CIAvash[m] joined #perl6

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

Perl 6 | Reference Documentation | Rakudo