🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:01 kensanata left 00:14 Jack-20 left 00:30 atta joined 00:32 atta left 00:42 sena_kun left 00:56 farcas82regreg joined, sena_kun joined 01:55 melezhik joined 02:13 wildtrees left 02:27 melezhik left 02:42 sena_kun left 02:58 sena_kun joined 04:42 sena_kun left 04:57 sena_kun joined
xinming termbin.com/b7qp <---- In this example, Why will the first interval supply output everything after the tap is closed please? 05:35
When time is up, for [0] .. [1] .. [2] .. [3] .. [4] They doesn't print in sequence, They just print everything at once, after the tap is closed. But the latter interval=[$t] prints one by one correctly. 05:37
Anyone here would tell me the reason for this? 05:54
05:57 evalable6 left
elcaro xinming: I'm not very familiar with Supplies, and unfortunately, this is not the best hours for this channel. You will be more likely to get a response during daylight hours UTC 05:58
xinming: however, i suspect it might be something with the 'do' waiting until the block is finished evaluating before it can assign anything to $tap. just a guess, tho 05:59
06:00 evalable6 joined
xinming Ok, Will trouble here later. 06:27
06:34 BillyC joined 06:42 sena_kun left
xinming I think I know the reason, the react block is blocked until sleep returns in react block. 06:50
Xliff . 06:54
06:54 wamba joined 06:55 BillyC left, Xliff left 06:57 sena_kun joined 07:08 rindolf joined
xinming www.youtube.com/watch?v=hGyzsviI48M <--- This video should also be put in the raku cocurrency doc page. 07:54
08:11 sena_kun left 08:12 sena_kun joined 08:16 gabiruh joined 08:19 gabiruh_ left 08:29 jmerelo joined
Voldenet xinming: I'm not sure, but I think react block is single-threaded 08:42
so, "sleep 5" blocks everything
xinming Yea, I later realized that.
08:42 sena_kun left
Voldenet if you need to do timeouts, promises are a lot better 08:47
08:50 chloekek joined 08:55 sena_kun joined 08:57 scimon joined
scimon Happy new year 09:18
Voldenet happy new year, I've got a question
chloekek Go ahead! 09:19
Voldenet a propos promises: js has Promise.race, C# has Task.WhenAll
raku has Promise.anyof, however it doesn't return the first promise
m: say await Promise.anyof(Promise.in(1).then({ "one" }), Promise.in(2).then({ "two" }))
camelia True
Voldenet it's possible to do this: 09:21
m: sub anyof(|p) { await Promise.anyof(|p); |p.first({ $_.status ~~ Kept | Broken }) }; say await anyof(Promise.in(1).then({ "one" }), Promise.in(2).then({ "two" }))
camelia (one)
Voldenet however, isn't there better way?
Java has CompletableFuture.anyOf, which returns a result too 09:25
so, maybe it would be good if Promise.anyof actually awaited first promise by default as well 09:28
s/first promise/first completed promise/ 09:29
m: sub anyof(|p) { await Promise.anyof(|p); |p.first: *.Bool }; say await anyof(Promise.in(1).then({ "one" }), Promise.in(2).then({ "two" })) 09:30
camelia (one)
chloekek That doesn’t necessarily return the result of the first promise to complete. 09:31
A promise earlier in the list may complete between the await and the .first call.
Voldenet You're right, I guess the more proper way would be to reinvent the anyof fully 09:32
chloekek The implementation isn’t very complicated: github.com/rakudo/rakudo/blob/f00a...#L282-L307 09:33
xinming termbin.com/wpjk <---- In This example, When timedout, Will the .get request being forcefuly aborted? Or they still running in background please? 09:40
Voldenet m: sub anyof(|p) { my $l = Lock.new; my $p = Promise.new; for |p { .then( -> $r { $l.protect({ return if $p; if $r.status ~~ Kept { $p.keep($r.result); } else { $p.break($r.cause) } }) }) }; $p }; say await anyof(Promise.in(1).then({ "one" }), Promise.in(2).then({ "two" })) 09:42
camelia one
Voldenet m: sub anyof(|p) { my $l = Lock.new; my $p = Promise.new; for |p { .then( -> $r { $l.protect({ return if $p; if $r.status ~~ Kept { $p.keep($r.result); } else { $p.break($r.cause) } }) }) }; $p }; say await anyof(Promise.in(1).then({ "one" }), Promise.in(.5).then({ die "two" }))
camelia An operation first awaited:
in block <unit> at <tmp> line 1

Died with the exception:
two
in block at <tmp> line 1
Voldenet xinming: No, it will probably not, timeouts (or cancellations) that actually abort hanging connections need to be implemented in the client 09:47
xinming Voldenet: Yea, that's the issue. I wish that we can abort the connection 09:48
Voldenet: Even if we use die there? 09:49
scimon I don't know if Timer::Breakable might help. I wrote it a while back. Lets you fire up a timed block that you can stop if need be. 09:50
I mostly wrote it as a test.
xinming scimon: But the problem is, The connection is also async. 09:51
scimon Ahhh... Hmmm
So. If you start your async request. Then set a Timer::Breakable to kill it. Then await anyof these. If your async request has passes stop the breakable... Maybe? 09:53
Voldenet xinming: the real question is where Cro::HTTP::Client.get is being invoked 09:59
xinming Voldenet: What I try is try to implement the timeout for Cro::HTTP::Client, As it doesn't support timeout 10:00
So even in the example it doesn't, I'll try
Voldenet but the connection to the server will probably not be closed in this case, it's complicated 10:03
10:15 timotimo left
xinming m: sub t { start { return }; }; t 10:28
camelia ( no output ) 10:29
xinming This will cause MoarVM panic MoarVM panic: Internal error: Unwound entire stack and missed handler
AlexDaniel yeah
xinming Are these bugs known?
AlexDaniel not sure if there's a ticket
it's obviously a case of “Doctor, it hurts when I do this” 10:30
so not necessarily a very important issue, but it's still a bug that needs to be fixed
Voldenet m: sub t { start { return }; }; await t
camelia An operation first awaited:
in block <unit> at <tmp> line 1

Died with the exception:
Attempt to return outside of immediately-enclosing Routine (i.e. `return` execution is outside the dynamic scope of the Routine where `return` was used…
xinming SO, Ok, So, already fixed, Just need the right way to get the right error. 10:32
10:35 sena_kun left 10:39 bartolin left, camelia left, Grrrr left 10:42 Suya left
lizmat m: sub t { start sub { return } }; t 10:43
evalable6
lizmat xinming: if you want to be able to return out of your start block ^^
xinming lizmat: I don't, I just test something thing, and meet that, so I reported here. 10:44
lizmat m: { return }
evalable6 (exit code 1) Attempt to return outside of any Routine
in block <unit> at /tmp/hrn_UX35V3 line 1
lizmat m: return
evalable6 (exit code 1) Attempt to return outside of any Routine
in block <unit> at /tmp/jXjL2eSITJ line 1
lizmat yeah, these are DIHWIDT cases :-) 10:45
10:47 bartolin joined 10:49 camelia joined 10:50 Grrrr joined, sena_kun joined 11:01 pilne left
Geth_ ¦ problem-solving: lizmat assigned to jnthn Issue Generalization of the "settings" concept github.com/perl6/problem-solving/issues/143 11:03
11:17 jmerelo left, mojca joined
mojca I would like to ask for some help building rakudo on macOS. Version 2019.07.1 built just fine. With 2019.11 I'm running into the following issue: paste.macports.org/e57b325c634d 11:18
Failed to flush filehandle: Operation not supported
The tests from nqp seem to all pass.
11:21 Poohmaan left
lizmat mojca: I think this has already been reported: github.com/MoarVM/MoarVM/issues/1225 11:33
I think it is waiting for jnthn to decide
11:37 Kaiepi joined 11:44 Tirifto joined 12:02 laama joined
chloekek p6: foo: goto foo; 12:24
camelia Label.goto() not yet implemented. Sorry.
in block <unit> at <tmp> line 1
12:42 sena_kun left
lizmat chloekek: we really haven't needed it so far :-) 12:48
chloekek p6: my $state = 0; loop { fsm: given $state { when 0 { $state = 0; next fsm } } } 12:50
camelia labeled next without loop construct
in block at <tmp> line 1
in block <unit> at <tmp> line 1
chloekek p6: my $state = 0; fsm: loop { given $state { when 0 { $state = 0; next fsm } } } 12:51
camelia (timeout)
12:56 sena_kun joined 13:23 lucasb joined 13:33 Xliff joined
Xliff .seen sena_kun 13:33
tellable6 Xliff, I saw sena_kun 2020-01-01T21:35:41Z in #raku: <sena_kun> tbrowder: sorry, I mean, can't we get a shorter name, `raku-advent.blog`, or `raku-advent-calendar.blog` is the only option?
Xliff sena_kuuun?
13:37 mensvaga joined
Xliff Can perl6 take code and output it to .moarvm, or is that best left to nqp? 13:45
And if so, how can perl6 be used to execute a block of .moarvm code? 13:46
13:46 kensanata joined
lizmat if you look at module loader logic, you should be able to find out how to load a .moarvm file, because that's what .precomp files are all about 13:46
Xliff And this module loader logic lies where? 13:47
Rakudo (hey! I remembered!) is a pretty big project...
lizmat aahh... now, that's quite a twisted maze of NQP and Raku interaction 13:48
I guess you could start with looking for RAKUDO_MODULE_DEBUG in the source code
Xliff heh... 13:49
World.nqp, then?
I see gen/moar/ModuleLoader.nqp, also.... 13:50
lizmat yeah, as I said... 13:51
it's a twisty little maze
or maybe not so little
Xliff OK. And generating .moarvm code from...say...perl6?
tadzik you mean raku?;) 13:52
lizmat :-)
Xliff (...and as soon as I get it right... I slide right back wrong again.... drat!) 13:53
tadzik++
lizmat Xliff: the moarvm code is created by the compilation process (e.g. in sub EVAL)
this then either gets executed, or written to disk
Xliff Huh. I should have thought of that. 13:54
lizmat I'm not that familiar with the exact process to be more helpful than that
Xliff nqp::bindhllsym('perl6', 'ModuleLoader', Perl6::ModuleLoader); # Note this makes it invisible inside Perl 6 itself. 13:58
/o\
Any idea as to how I can get access to some of that code? 13:59
lizmat I know I just got completely burned out on that piece of logic :-( 14:01
Xliff ah 14:03
chloekek You could put the bytecode files in the directory layout of a precompiled repository and then import it with require. :) 14:04
Xliff O_O 14:05
Bit I'd have to figure out how to name the file.
s/Bit/But/
chloekek If you precompile a whole distribution instead of a single .pm6 file you can use this function to precompile it to a (possibly new) repository at a given path: glot.io/snippets/fjcfa0c6bp 14:08
If you then put the repository in PERL6LIB you can import from it (or use lib, etc). But I don’t know if that’s what you’re looking for.
You must also ensure that the repository is already in PERL6LIB prior to calling that routine otherwise it’ll crash. 14:09
Oh yeah and the other caveat is that it must be the first entry in PERL6LIB. 🤡 14:11
lizmat feels to me we need a MoarVM:: HLL library for doing this sort of stuff 14:12
chloekek Would be zupahneat. 14:14
Speaking of NQP and getting information from point A to point B, I looked into the NQP prefix issue for the profiling HTML template. 14:15
I couldn’t find how to get the NQP prefix from within NQP code, I don’t think it’s propagated anywhere, so the configure script would have to be modified. 14:16
Xliff chloekek: Ooh! Thanks! 14:22
Tirifto Hello! Does anyone have advice on how to utilise declarator blocks (‘#|’, ‘#=’) in POD? I tried attaching one to a class, but it got exported to HTML as a ‘h1’ heading, so it doesn't integrate very well into the rest of the document. The one attached to a method, on the other hand, got exported as normal text, which seems like quite the jump from a normal heading. :/ 14:23
Xliff I think I will also look at EVAL.
Tirifto: Can you paste a gist showing how you are using them?
bbl 14:28
14:29 kensanata left
Tirifto Xliff: Have a safe journey; it looks something like this: paste.gnome.org/pqvcegxgq 14:29
14:32 AlexDani` joined 14:34 AlexDaniel left 14:41 AlexDani` left 14:42 sena_kun left
Tirifto …looks like methods are exported as ordinary text, but attributes are exported as ‘h1’ headings, without their name even mentioned. 14:54
chloekek Pod::To::HTML needs more work. It has subtle issues with document structure.
Tirifto When I read the documentation, I thought the declarator would be exported to POD along with whatever code was underneath simply attached, but apparently it examines the code in some way. 14:55
chloekek: Ah, alright; I'll see how it looks in MarkDown and text! 14:56
14:58 sena_kun joined
tbrowder any blockers or nay votes for "raku-advent.blog" for the Raku Advent blog currently on "rakuadventcalendar.wordpress.com"? 14:59
going three times...
Tirifto Well, looks like Pod::To::HTML has problems with structure, Pod::To::Markdown can't handle ‘=defn’s (but handles declarator blocks nicely), and Pod::To::Text sees attributes as classes… 15:07
15:10 melezhik joined
Tirifto Might try and see if I can write a patch. 15:12
15:14 mspo left 15:17 Doc_Holliwood joined
melezhik Hi AlexDaniel: have you managed to check RakuDist? Any thoughts ? thanks 15:21
uzl[m] tbrowder: What are the other options for the domain name? For me, "raku-advent.blog" looks fine so ++ on that one. 15:25
melezhik probably should have used AlexDaniel`: for my last message 15:30
15:45 xinming left 15:46 xinming joined 15:47 Poohman joined
tbrowder uzl[m]: anything is available if shown as such on any registrar's domain search page 15:52
the current "popular" choice (from about three or four votes) is "raku-advent.blog" 15:53
15:53 mahmudov joined
tbrowder the only reason we need to choose soon is to (1) ensure we can get the desired name and to (2) get started with the changeover and its logistics and marketing rather than waiting... 15:55
and avoid "bike shedding"?
chloekek raku-advent.blog is descriptive and memorable, which is amazing. 15:56
Great properties for a domain name.
16:10 chloekek left 16:24 AlexDani` joined 16:33 patrickb joined, xinming left, xinming joined 16:36 AlexDani` is now known as AlexDaniel, AlexDaniel left, AlexDaniel joined 16:42 sena_kun left 16:56 sena_kun joined 17:00 patrickb left 17:03 chloekek joined
cpan-raku New module released to CPAN! Chart::Gnuplot (0.0.17) by 03TITSUKI 17:03
tbrowder chloekek: i ++agree 17:05
El_Che lo 17:06
chloekek tbrowder: with what?
tbrowder El_Che: \o/ 17:07
chloekek: everything you said
chloekek I forgot what it was. I will check the logs.
17:07 benjif_ is now known as benji
chloekek Ah about the domain name. 17:08
tbrowder at 1056
17:08 benji is now known as benjif
tbrowder yes, sorry i didn’t notice time. i’m traveling and off and on 17:09
chloekek just traveled home :) 17:12
17:17 scimon left 17:34 pilne joined 17:52 AlexDani` joined 17:54 AlexDaniel left 18:04 aluaces joined 18:06 patrickb joined 18:15 kensanata joined 18:18 mahmudov left 18:20 mahmudov joined 18:28 wildtrees joined 18:29 wildtrees left, wildtrees joined 18:32 wildtrees left, wildtrees joined 18:33 thundergnat left 18:42 sena_kun left 18:57 stoned75 left 18:58 sena_kun joined 19:02 RobRaku joined 19:07 rindolf left 19:14 RobRaku left
Tirifto In the ‘Getopt::Long’ module, the subroutine ‘get-options’ takes a list of pairs, which ought to be ‘string => variable’, but it lets me write a pair in which I assign a default value to a variable, like this: ‘“verbose|v+” => (%opts<verbose> = 4)’. Does anyone know how that works? I would expect the assignment to return the number 4. 19:17
19:18 rindolf joined
moritz m: say (my $x = 42).VAR 19:24
camelia 42
moritz m: say (my $x = 42); say $x.VAR 19:25
camelia 42
42
moritz out of practice
m: say (my $x = 42); say $x.VAR.^name
camelia 42
Scalar
moritz m: say (my $x = 42); say $x.VAR.name
camelia 42
$x
moritz m: say (my $x = 42).VAR.name
camelia $x
moritz Tirifto: the assignment actually returns the variable, not the value that it's in, as demonstrated above 19:26
it's just that most operations (like method calls etc.) take the value out of the variable, so you don't notice it usually
19:29 sauvin left
Tirifto moritz: Aha! Guess the REPL does the same. Makes sense; thanks! 19:29
19:31 RobRaku joined 19:35 RobRaku left 19:37 aluaces left
mojca lizmat: thank you for the pointer to github.com/MoarVM/MoarVM/issues/1225; the ticket mentions 2019.07.1 though, which seems to build for me, but I'll happily wait for the solution 19:49
lizmat then I'm not sure what's going on 19:51
but could be a good idea to add your experiences to the ticket just in case
20:10 mahmudov left 20:12 mahmudov joined 20:18 wildtrees left 20:22 Suya joined 20:26 kensanata left 20:30 thundergnat joined
chloekek I want to make a document writing EDSL in Raku. Like LaTeX, but with $* instead of globals, and piggybagging on HTML/CSS/SVG for actual rendering, and not having PDF (or similar reader-unfriendly formats) as a target. 20:37
lizmat ++chloekek 20:38
chloekek There are many things you can customize, such as font size and font family and color and text alignment and borders and so on, so $* seems like a nice thing for that. 20:42
Nicer than redefining global macros at least. :þ
And you can also use $* to keep track of chapter and section numbers.
20:42 sena_kun left
uzl[m] m: my @a = 1..5; @a[3..8].say 20:46
camelia (4 5 (Any) (Any) (Any) (Any))
uzl[m] What's this behavior called? Would this also be autovivification?
chloekek m: my @a = 1..5; @a[3..8].say; say @a 20:48
camelia (4 5 (Any) (Any) (Any) (Any))
[1 2 3 4 5]
chloekek Pretty much.
20:48 cpan-raku left
chloekek No wait, it doesn’t modify the array. 20:48
I’d call it Nil-padding probably. xþ
20:49 cpan-raku joined, cpan-raku left, cpan-raku joined
lizmat actually, it is *delayed* autovivification 20:50
observe:
m: my @a; my $b := @a[2]; $b = 42; dd @a 20:51
camelia Array @a = [Any, Any, 42]
lizmat m: my @a; my $b := @a[2]; dd @a; $b = 42; dd @a
camelia Array @a = []
Array @a = [Any, Any, 42]
lizmat m: my @a; my $b := @a[2]; dd $b<>
camelia Any
lizmat hmmm
m: my @a; my $b := @a[2]; use nqp; dd nqp::iscont($b) 20:52
camelia 1
lizmat so, even if there's no value in the array, it *does* return a container that you can assign to, which will create the array element when assigned to
same for hashes:
m: my %h; my $b := %h<a><b><c>; dd %h; $b = 42; dd %h 20:53
camelia Hash %h = {}
Hash %h = {:a(${:b(${:c(42)})})}
lizmat and muitiple levels deep :)
*multiple
uzl[m] That makes sense. Thanks! 20:54
20:56 sena_kun joined 20:57 melezhik left 21:10 melezhik joined 21:11 AlexDani` left, AlexDani` joined
chloekek p6: say :1px 21:28
camelia Unexpected named argument 'px' passed
in block <unit> at <tmp> line 1
chloekek p6: say (:1px) 21:29
camelia px => 1
chloekek Love this feature.
21:29 mensvaga left 21:34 kensanata joined 21:38 stoned75 joined 21:40 AlexDani` is now known as AlexDaniel, AlexDaniel left, AlexDaniel joined 21:49 Tirifto left 21:56 chloekek left 22:01 rindolf left
Geth_ doc: 3cd20ae522 | (Stoned Elipot)++ | doc/Language/typesystem.pod6
xref subset
22:11
22:21 Suya left 22:31 melezhik left 22:34 farcas82regreg left 22:41 sena_kun left 22:55 sena_kun joined 23:06 kensanata left 23:08 Geth_ left, Geth joined 23:32 wamba left 23:37 Kaiepi left 23:38 Kaiepi joined
Geth doc: threadless-screw++ created pull request #3137:
Clarification of item and list assignment syntax and evaluation.
23:58