šŸ¦‹ Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
00:00 Kaipei is now known as Kaiepi 00:06 reportable6 left 00:09 reportable6 joined 00:11 Sgeo joined 00:26 ajr left 00:39 deoac left 01:07 Colere left 01:09 Colere joined 01:28 Geth left, Geth joined 01:33 Geth__ joined, Geth left
tonyo hi ingy 02:20
02:33 linkable6 left, evalable6 left 02:35 linkable6 joined 02:36 evalable6 joined 03:36 shareable6 left, committable6 left, evalable6 left, sourceable6 left, coverable6 left, squashable6 left, tellable6 left, statisfiable6 left, notable6 left, greppable6 left, bloatable6 left, linkable6 left, releasable6 left, notable6 joined, releasable6 joined, tellable6 joined, shareable6 joined, squashable6 joined, coverable6 joined 03:37 evalable6 joined, statisfiable6 joined 03:38 sourceable6 joined, committable6 joined, linkable6 joined, greppable6 joined, bloatable6 joined 03:54 pamplemousse left 04:23 ed left 05:23 tellable6 left, evalable6 left, bisectable6 left, committable6 left, sourceable6 left, bloatable6 left, unicodable6 left, linkable6 left, quotable6 left, reportable6 left, greppable6 left, nativecallable6 left, benchable6 left, coverable6 left, squashable6 left, releasable6 left, statisfiable6 left, notable6 left, reportable6 joined, sourceable6 joined, quotable6 joined 05:24 releasable6 joined, committable6 joined, greppable6 joined 05:25 linkable6 joined, bisectable6 joined, bloatable6 joined, evalable6 joined, coverable6 joined, squashable6 joined, benchable6 joined, tellable6 joined, statisfiable6 joined, notable6 joined, unicodable6 joined 05:26 nativecallable6 joined 06:07 reportable6 left 06:09 reportable6 joined 06:50 Sgeo left 07:25 frost joined 07:42 Geth joined 07:44 RakuIRCLogger__ joined, Geth__ left 07:46 RakuIRCLogger left 07:47 Geth left, Geth joined 08:07 dakkar joined 08:14 Geth left 08:15 Geth joined, RakuIRCLogger__ left 08:18 sena_kun joined 08:32 Oshawott left 08:33 Oshawott joined 08:38 dogbert17 left
Nemokosch reinventing the wheel be like 08:53
> git log | raku -pe 'last if /^^ "commit " / && $++ >= 10'
in other words: git log -10
lizmat SmokeMachine: if you want to use rak as a sub, would you need all of its features, or a subset ? 09:19
if subset, what subset ? :)
SmokeMachine lizmat: Iā€™m thinkingā€¦ but I assume at least most of themā€¦ let me thinkā€¦ 09:28
09:32 lizmat_ joined 09:33 sena_kun left 09:34 lizmat__ joined 09:35 lizmat___ joined 09:36 lizmat left 09:37 lizmat_ left 09:39 lizmat__ left 09:40 lizmat___ is now known as lizmat
Nemokosch How can I catch all the arguments of a function (so that I can propagate them to another function)? 10:12
Perhaps I will rather use a decorator-ish pattern but still worth asking imo
SmokeMachine m: sub bla(|c) { say |c }; bla ā€œtestā€, 42 10:14
camelia test42
Nemokosch does it pick up named arguments as well? 10:16
lizmat it does 10:25
if you're interested in *only* the named arguments, you should use a slurpy hash 10:26
Nemokosch thankies 10:28
does `last` set the return value of a block? 10:32
lizmat not in 6.c 10:33
10:33 sena_kun joined
lizmat in 6.e you can "last 42" 10:33
m: use v6.e.PREVIEW; say (^10).map: { $_ == 5 ?? (last 42) !! $_ } 10:34
camelia (0 1 2 3 4 42)
lizmat m: say (^10).map: { $_ == 5 ?? (last 42) !! $_ }
camelia ===SORRY!=== Error while compiling <tmp>
Calling last(Int) will never work with any of these multi signatures:
( --> Nil)
(Label:D $x --> Nil)
at <tmp>:1
------> say (^10).map: { $_ == 5 ?? (ālast 42) !! $_ }
Nemokosch wow 10:35
while this is good to know, actually this wasn't the essential question I should have asked
say I have a piece of code &actions
and I want to do `return actions`, or could be `last actions` in this other example
what happens if actions throws?
lizmat if it doesn't get caught in a CATCH, your ptogram will die 10:42
Nemokosch I'm gonna show an example code that I don't fully understand 10:44
I'm trying to emulate error and retrial 10:45
If Pidgin starts...
10:46 Nemokosch joined
Nemokosch m: sub demo2 { loop { CATCH { say "OKAY WTF." }; return { die 'Now!' unless (1 .. 10).pick == 1; 12 }(); } } 10:47
camelia ( no output )
Nemokosch oops, maybe it should be called as well...
m: sub demo2 { loop { CATCH { say "OKAY WTF." }; return { die 'Now!' unless (1 .. 10).pick == 1; 12 }(); } }; demo2 10:48
camelia OKAY WTF.
Now!
in block at <tmp> line 1
in sub demo2 at <tmp> line 1
in block <unit> at <tmp> line 1
Nemokosch This is what I always get. Caught at first, dies after.
Or caught and yet dies? I don't know how this works.
lizmat you didn't handle the exception in the CATCH block, so it is being rethrown by a CATCH block higher up 10:49
m: CATCH { say "CATCH"; .resume }; say "before"; die; say "after"
camelia before
CATCH
after
Nemokosch well, what does "handling" mean? I'm used to the block itself doing the distinguishing, a la C++ and derived languages 10:50
"distinguishing", almost... extinguishing xd 10:51
lizmat then why did you want a CATCH block ? todo something with the exception, no ? 10:55
*to do
Nemokosch Well for now I wanted to see if it's caught 10:56
lizmat m: CATCH { say "CATCH" }; say "before"; die; say "after"
camelia before
Died
in block <unit> at <tmp> line 1

CATCH
lizmat m: CATCH { say "CATCH" }; note "before"; die; note "after" 10:57
camelia before
CATCH
Died
in block <unit> at <tmp> line 1
lizmat say is on STDOUT, camelia got some syncing issues there, using note makes the sequence more clear
making all output happening on STDERR 10:58
Nemokosch without dying, that is :D anyway, I was looking at this .resume... I'm not sure I want to give the control flow back to where the error happened
I just want to keep the loop running so that there can be a retry 10:59
lizmat m: for ^10 { CATCH { next }; die if $_ == 5; .say } 11:00
camelia 0
1
2
3
4
6
7
8
9
lizmat make sure the CATCH is inside the loop
m: for ^10 { CATCH { say "CATCH"l; next }; die if $_ == 5; .say }
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> for ^10 { CATCH { say "CATCH"āl; next }; die if $_ == 5; .say }
expecting any of:
infix
infix stopper
postfix
ā€¦
11:01
lizmat m: for ^10 { CATCH { say "CATCH"; next }; die if $_ == 5; .say }
camelia 0
1
2
3
4
CATCH
6
7
8
9
Nemokosch okay, good enough overall. This leads to... 11:03
Nemokosch gist.github.com/2colours/255b578e6...c21cd70bf9 11:04
lizmat you want to return the result of calling &actions, right ?
Nemokosch yes :plad 11:06
šŸ„ŗ
lizmat so what is the problem with that code?
Nemokosch Well, nothing anymore, I hope? šŸ˜„
Will see the rest. Thanks for the help!
lizmat well.. it will continue to retry on failure... which may be excessive 11:07
especially if the failure is quick, you're going to burn a lot of CPU there
so I'd put a max on the number of retries, and maybe put in an increasing delay on retries
Nemokosch I doubt the failure is going to be quick. There is a 20 seconds timeout on the requests typically, could be even more 11:08
lizmat ah, ok
glad to have been of help :-) 11:10
Nemokosch I'm trying to not over-engineer it because it's gonna be something that "only has to work" once in a month or so
we host the service that should be accessed so if there is serious trouble, probably it will escalate to other systems and shutting down poor script won't be the biggest deal šŸ˜…
lizmat gotcha :-)
well, it's some form of production :-)
Nemokosch I updated the gist with a "usage example" 11:14
lizmat looks ok from here 11:21
Nemokosch Hopefully it will work okay. I kinda like this style 11:22
lizmat :-) 11:23
11:46 evalable6 left, linkable6 left 11:47 linkable6 left 11:49 linkable6 joined, evalable6 joined
Nemokosch Lesson to learn: .kv only works for Maps, not Positionals of Pairs - however, for loop with :key and :value destructuring works for both 12:00
lizmat yep, that's because a loop on a Map will produce a list of Pairs 12:01
m: my %h = a => 42, b => 666; for %h { dd $_ }
camelia :b(666)
:a(42)
lizmat m: my %h = a => 42, b => 666; for %h { dd .^name }
camelia "Pair"
"Pair"
12:06 Voldenet_ joined 12:07 reportable6 left, Voldenet left, Voldenet_ is now known as Voldenet 12:09 reportable6 joined 12:15 Nemokosch left 12:29 Nemokosch joined
ingy hi tonyo 13:17
13:29 linkable6 left, evalable6 left 13:30 vrurg_ is now known as vrurg, evalable6 joined 13:31 linkable6 joined
ingy tonyo: how can I `fez login` from a script (not interactively) 13:46
I could use `expect` but hopefully I can just curl something? 13:47
lizmat ingy: afaik, you only need to do that once a month ? 13:52
14:17 morte_ joined
ingy lizmat: this is for an ephemeral environment 14:24
lizmat then why upload it to fez ?? On fez it will stay there *forever* !! 14:25
ingy I'm not sure we are talking about the same thing. 14:27
14:28 frost left
ingy I have a tool that can publish modules in various languages. It runs in docker. It uses a credentials file containing fez creds and others. 14:28
When I do a `pst publish` in a raku module repo it should `fez login` and `fez upload` 14:29
I guess I'll look in the fez code and see what it's doing. I just thought I could get a quicker answer here :) 14:30
lizmat sorry to have disappointed you 14:31
15:22 guifa_ joined 15:25 guifa left 15:37 sena_kun left 16:19 morte_ left 16:36 dakkar left
El_Che that sounds a tad dramatic 16:40
lizmat sorry, but the person in question *always* wants it the quick and easy and lazy way, and I'm grumpy today 16:44
[Coke] offers lizmat something from the ice cream truck that just went through Coke's neighborhood. 17:01
... or I would, if they ever drove by my house! They always go around!
17:01 ajr joined 17:03 ProperNoun left
leont Given the weather in NL at the moment I'm pretty sure ice cream would be welcome 17:05
17:14 mexen left
lizmat yeah.. will probably go out in 30 mins or so to get some 17:21
[Coke] \o/ 17:31
17:32 morte_ joined
[Coke] ... which I guess is the chocolate at the bottom of a coronetto? 17:39
17:47 deoac joined, japhb left 17:55 japhb joined 18:07 reportable6 left 18:08 reportable6 joined 18:17 human-blip left 18:18 human-blip joined 18:31 mexen joined 18:43 sena_kun joined 18:49 nort left 18:51 deoac left 19:51 linkable6 left, reportable6 left, squashable6 left, statisfiable6 left, sourceable6 left, greppable6 left, bloatable6 left, notable6 left, releasable6 left, unicodable6 left, tellable6 left, evalable6 left, coverable6 left, benchable6 left, quotable6 left, bisectable6 left, shareable6 left, nativecallable6 left, committable6 left 19:52 bloatable6 joined, sourceable6 joined, benchable6 joined, shareable6 joined 19:53 greppable6 joined, releasable6 joined, evalable6 joined, bisectable6 joined, statisfiable6 joined, nativecallable6 joined, quotable6 joined, reportable6 joined, notable6 joined 19:54 coverable6 joined, squashable6 joined, committable6 joined, tellable6 joined, unicodable6 joined, linkable6 joined 20:27 ProperNoun joined 20:33 djerius left, djerius joined 20:50 ProperNoun left 20:51 ProperNoun joined 21:15 Nemokosch left 21:16 squashable6 left 21:17 squashable6 joined 21:58 morte_ left 22:02 pamplemousse joined 22:55 Sgeo joined 23:18 sena_kun left 23:21 irc_user joined 23:25 delon joined 23:26 delon left